Development requires that a user control Form and button event need to be moved to the webpage for processing.
What should I do? For example, the user control has a text box, a single selection, and a button. Originally, the processing logic is processed in the user control. Now these logic processes need to be moved to the web page.
What is the web page? The webpage also has a button. When the user clicks this button, the button event dynamically loads the user control.
After the operation user enters the text box, select the single option and click the Save button. The entered information needs to be displayed on the webpage.
This is what it looks like.
Insus. NET first designs User Controls:
Go to. UcA. ascx. cs to write code,
Create a webpage in the site:
When you click the button on the webpage to load the user control, and the user clicks the button again, the status of the webpage disappears, that is, the lifecycle has ended. To solve this problem, refer to this article first:
Http://www.cnblogs.com/insus/archive/2012/10/09/2717420.html
Write a method to dynamically load User Controls
There is a delegate UcA1_Saving ()
After preparation is complete, Insus. NET writes the Click Event of the button of the webpage:
As we mentioned earlier, after the operator clicks the user control to save the button, the webpage status will be retained. Therefore, some programs need to be executed in the Page_Load event of the webpage:
After that, let's see the animation demonstration: