且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

动态(以编程方式)添加复选框和已更改事件

更新时间:2023-10-06 21:40:46

您应该执行以下操作:

You should do the following:


  1. CheckBox的每个实例设置 ID 您在 foreach 循环中创建。

  2. 对于PostBack,请确保您的复选框已创建, CheckedChanged 事件处理程序附加在页面生命周期的某个时候,控制事件发生之前

  1. Set the ID property for each instance of CheckBox you create in your foreach loop.
  2. For PostBacks, ensure that your CheckBoxes are created and CheckedChanged event handler is attached at some point of the page life-cycle before control events are raised