Dynamic control:
1 ,
After using the LoadControl load control, some of the controls in the user control no longer respond to the event.
This problem is mainly caused by loading controls within IF (! Page.ispostback), and placed outside. in
This issue has been described in detail on the blog of Site.
2,
There is a problem with some controls in the user control. If a button is selected for the first time, the Click event is not triggered, the second time.
This is because the control ID is not caused by setting the ID, the control ID is described in detail below. Such as
Control UserControl = (Control) Page.loadControl ("Test.ascx");
UserControl.id = "test"; addControl (UserControl);
3. If you include a DataGrid control in the user control, you may have problems with the DataGrid event after loading the control. This seems to be a bug, you must enforce the loaded control, such as test userControl = (TEST) Page.loadControl ("Test.ascx"); Note: Top Test Type, not Control! 4, How to use JavaScript in the user control. Everyone knows that using the client's script will greatly increase the response speed of the page, while avoiding frequent refreshing pages. So use JavaScript to implement partial control in the page is a better way, but if you access a child control in the user control? The way is as follows: Document.all. <% = TestControl.clientID%> <% = lstract ketuser.clientID%>. Disabled = true; // Set TestControl to not available If you should write this in the C # script: Page.RegisterStartupScript "OnInitControl", "