adding an event handler to a dynamically created checkbox (aspx, c#)

后端 未结 1 1659
太阳男子
太阳男子 2021-01-19 18:52

So my problem is that I want to add an event handler to a dynamically created CheckBox. I have already looked at other ways to do this, and decided that creating a dynamic t

相关标签:
1条回答
  • 2021-01-19 19:17

    In order for dynamically loaded controls to be handled properly during the ASP.NET Page Lifecycle, they need to be added to the page during OnInit (or prior to LoadViewState, really) otherwise their state information will not be maintained and you can, in fact, corrupt the viewstate depending on how/where things are added in the page's control graph.

    0 讨论(0)
提交回复
热议问题