Custom Event in .NET

Hello All,

Today I will try to deliberate my experience on custom event creation in .NET , Actually I was trying to find something like hands on for event creation in .NET application, suddenly I got a quick help from one of my brother Sadique, who helped me out to resolve the thirst.

We are going to create a custom control where we will define our event class and event handler.To do that first take a  user control named InputControl.ascx  . The ascx page is as bellow.

In that page I put a textbox control to take input , a button control to fire our custom event handler and a label to show our input result through our custom event.

The InputControl.ascx.cs code behind file is as bellow :

Now I register the control in my Default.aspx page as bellow .

In the file above we have to focus on OnCustomEventSubmit="icEventBox_CustomEventSubmit" which is pointing our custom event.

The code behind file Default.aspx.cs is as bellow.

In the above article I didn’t go for much brief discussion , I think the code is sufficient to describe a custom event itself.

That’s all for the day.


User ScrumPad for your Agile based projects.