Access Click Event in Dynamically Built DataGrid
-
I have developed a form with a datagrid based on the code provided by Mark Killmer found here at http://www.codeproject.com/asspnet/griddemo.asp and http://www.codeproject.com/asspnet/griddemo2.asp. My grid requires LinkButtons instead of Drop Downs, TextBoxes, or CheckBoxes. I have the grid populated and the LinkButtons do appear, however I am unable to trigger the click event so that I can move from this form to another form. I tried both methods from his follow-up article, but the server side code is not triggered and the JavaScript code location.href = "http://www.site.com/newpage.aspx" does not work either. Anyone have an idea of how I can acheive this functionality? Thank you, Anthony
-
I have developed a form with a datagrid based on the code provided by Mark Killmer found here at http://www.codeproject.com/asspnet/griddemo.asp and http://www.codeproject.com/asspnet/griddemo2.asp. My grid requires LinkButtons instead of Drop Downs, TextBoxes, or CheckBoxes. I have the grid populated and the LinkButtons do appear, however I am unable to trigger the click event so that I can move from this form to another form. I tried both methods from his follow-up article, but the server side code is not triggered and the JavaScript code location.href = "http://www.site.com/newpage.aspx" does not work either. Anyone have an idea of how I can acheive this functionality? Thank you, Anthony
Hi there, You dynamically add controls at runtime, you also need to reinsert them during postback to the server in order for the postback events to run properly. For more information, you can also look at the following documents: Adding Controls to a Web Forms Page Programmatically[^] Control Execution Lifecycle[^]
-
Hi there, You dynamically add controls at runtime, you also need to reinsert them during postback to the server in order for the postback events to run properly. For more information, you can also look at the following documents: Adding Controls to a Web Forms Page Programmatically[^] Control Execution Lifecycle[^]
-
I read the two articles that you suggested and did not see how to solve my problem. I may have also missed it since my due date for this assignment is this Wednesday. If you have any other information or sites to check out please help. Thank you.
-
I read the two articles that you suggested and did not see how to solve my problem. I may have also missed it since my due date for this assignment is this Wednesday. If you have any other information or sites to check out please help. Thank you.
Well-done, In fact, these two links don't give you a straight answer, but they do give you some ideas on how the controls work especially when they are dynamically added. Once you understand the life cycle of the control, things become much easier for you.
-
Well-done, In fact, these two links don't give you a straight answer, but they do give you some ideas on how the controls work especially when they are dynamically added. Once you understand the life cycle of the control, things become much easier for you.