Error with the event handlers of dynamic linkbutton

后端 未结 2 1119
旧巷少年郎
旧巷少年郎 2021-01-21 14:25

I am retrieving data from database depending upon the texboxes input and storing in a datatable , after then from datatable im sending data into dynamic table and displaying tab

2条回答
  •  北海茫月
    2021-01-21 15:01

    You can add event handlers to the Page_Load event but the important think to remember is that they must be added on every page load. It is common to do setup type tasks such as this in a !Page.IsPostBack clause. When wiring up event handlers that's not the case otherwise they will seem to disappear

    if(!Page.PostBack)
    {
        control.EventRaised += new EventHandler(EventResponse)
    }
    

    is wrong and will result in the handler disappearing on postback

提交回复
热议问题