开发者

ASP.Net 2.0 Reference and manipulate a Checkbox control during postback

开发者 https://www.devze.com 2023-04-05 05:45 出处:网络
I have a checkbox control that\'s populated based on the validity of initial input values during form submission.Basically it works as follows:

I have a checkbox control that's populated based on the validity of initial input values during form submission. Basically it works as follows:

Initial page is rendered with texbox fields and a hidden Checkbox List control

-->The input from the text boxes are validated during postback and if they are good, the checkbox list is populated with other values and presented to the user.

I've tried searching for the checkboxlist control during post back in order to dynamically populate, but that app开发者_StackOverflow中文版roach didn't get me anywhere. Is it possible to find the checkbox list control and dynamically populate it during postback?


If you are checking the posted form values, you won't find your control there as it is restored from viewstate (if its not a dynamic control that is).

Is your checkboxlist dynamic or an actual control on the page you can see in your designer? What are you searching on postback? Are you using FindControl?

Use FindControl to search for it. If it doesn't exist then on postback then in Page_Init you'll want to dynamically create it again (only if it was a dynamic control to begin with)

0

精彩评论

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

关注公众号