我的ASP.NET表单包含一组动态创建的单选按钮,这些按钮在Page_Load事件处理程序中创建和配置。
通常,我使用条件:
在Page_Load处理程序中处理回发数据if (IsPostBack)
但是,由于我需要访问的控件是在Page_Load处理程序中创建的,因此上一次呈现页面的回发数据将丢失。为了更好地说明问题,这里是事件发生的概述:
1-Page_Load is invoked for the first time
2-An unknown number of radiobuttons are created dynamically
3-The radiobuttons are configured, based on information present on the server
4-The radiobuttons are added to the page's content
5-The user selects an option, and clicks the submit button
6-The Page_Load handler is invoked for the second time
7-The radio-buttons are added dynamically, exactly as before
8-The radio-button that the user checked is seemingly non-existant for processing
似乎我需要在不同的事件处理程序中处理它的不同部分。是否有回发后发生的事件,但原始的无线电按钮仍可访问?