asp:Button Click event not being fired

后端 未结 2 1897
春和景丽
春和景丽 2021-01-22 06:28

I am dynamically adding rows in an asp table. In each row of the table I am also including a button which has a SelectProduct_Click event.

The problem is that even thou

2条回答
  •  长发绾君心
    2021-01-22 07:19

    You need to learn about the ASP.NET page lifecycle.

    In order for dynamic controls to fire their events on postback, they need to be recreated and attached to the event handler again.

    The best place to create (and re-create) dynamic controls is in the OnInit event handler.

提交回复
热议问题