开发者

Bizarre updatepanel problem

开发者 https://www.devze.com 2022-12-08 00:32 出处:网络
I have an updatepanel, with a bunch of things in that are generat开发者_如何学Ced dynamically. Among them are textboxes, and checkboxes. Each is created in code with Textbox t = new Textbox() and Che

I have an updatepanel, with a bunch of things in that are generat开发者_如何学Ced 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号