views:

46

answers:

1

I have an updatepanel, with a bunch of things in that are generated dynamically.

Among them are textboxes, and checkboxes. Each is created in code with Textbox t = new Textbox() and Checkbox c = new Checkbox and are added withotu altering any other properties.

Later on when I hit "Save", I get the values. The Textbox value is whatever I typed in before I hit the save button, but the Checkbox is always false regardless of whether I checked it or not.

Is there any explanation for this discrepancy?

A: 

Another problem solved after hours of debugging... I fixed a problem a couple of days ago that was caused because my controls didnt have an ID when they were dynamically generated. I read somewhere that controls without IDs sometimes behave oddly...

So in this case I gave my controls (checkboxes, not the textboxes) a random GUID, but it changed every time they were redrawn, which confused the viewstate and meant it couldnt preserve the contents.

SLC