In ASP. NET Development: Adding properties to user controls this article defines a user logon user control UserLogin. the ascx file contains a LinkButton server button control. When you click this button, the server automatically generates a response to stimulate the Page. load event. In addition to the automatic sending of pages generated by the server. in addition to the Load event, we can add an event of our own to the LinkButton. It is actually very easy to add the event. By declaring the event in the <script> </script> block, add the event to the user control. The following example shows how to add events to the UserLogin. ascx user control.
UserLogin. ascx Public event Eventhandler Login; // Add event handleVoid MyOnClick (Object Sender, EventArgs e ){ If (Login! = Null) Login (this, new EventArgs (); // activate the Login event } </Script> |
Use custom events on the ASPX page:
<%@Register TagPrefix=”wen” TagName=”UserEvent” src=” UserLogin.ascx”%> |
Note: The OnLogin event here is an event we add to the UserLogin. ascx file of the user control.
Related Articles: ASP. NET development: Adding properties to user controls (