Search code examples
c#asp.netascx

Call to EventHandler in ASCX page


I am updating an ASCX page and I saw an EventHandler defined then later called. public event EventHandler Step1Submit; Then later on in the code Step1Submit(sender, e);

In the ASPX page, there is the tag

<uc3:SignUpStep1Control ID="signUpStep1" runat="server" 
                        OnStep1Submit="SignUpStep1_Click" />

My question is, when Step1Submit(sender, e); is executed, is it calling SignUpStep1_Click() event in the ASPX code behind?


Solution

  • You're "deferring" event handling for event "OnStep1Submit" to function SignUpStep1_Click. So yes SignUpStep1_Click will be executed, and you need to have it defined in your aspx.cs file in order to compile. Same thing as a click event on a button or any other event actually.