.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Santhakumar Munuswamy
Fauzul Azmi
Asad Ali

Home >> Forum >> .NET Framework >> Post New QuestionBookmark and Share Subscribe to Forum

what is EVENT handling?

Posted By: RASHMI KUSHWAHA     Posted Date: August 02, 2011    Points:5   Category :.NET Framework
what is EVENT handling in .net framework? please give me full detail of it how and where to use events?

Author: Amit Mehra             
Posted Date: August 03, 2011     Points: 20   


An event in C# is a way for a class to provide notifications to clients of that class when some interesting thing happens to an object. The most familiar use for events is in graphical user interfaces; typically, the classes that represent controls in the interface have events that are notified when the user does something to the control (for example, click a button).

You can use event when you need to do some programming when something happened..for eg.. if some text is changed in a textbox than TextChangedEvent get fired when page is postback [.cs or .vb file]

Ref madn

Please "Mark As Answer " if this post help you.
Author: Gowthammanju             
Posted Date: August 10, 2011     Points: 20   


An Event Handler is a subroutine that executes code for a given event.

there are various event handlers such as

The Page_Load Event:

The Page_Load event is one of many events that ASP.NET understands. The Page_Load event is triggered when a page loads, and ASP.NET will automatically call the subroutine Page_Load, and execute the code inside it.

<script runat="server">
Sub Page_Load
lbl1.Text="The date and time is " & now()
End Sub

<form runat="server">
<h3><asp:label id="lbl1" runat="server" /></h3>

The Page.IsPostBack Property:

The Page_Load subroutine runs EVERY time the page is loaded. If you want to execute the code in the Page_Load subroutine only the FIRST time the page is loaded, you can use the Page.IsPostBack property. If the Page.IsPostBack property is false, the page is loaded for the first time, if it is true, the page is posted back to the server (i.e. from a button click on a form):

<script runat="server">
Sub Page_Load
if Not Page.IsPostBack then
lbl1.Text="The date and time is " & now()
end if
End Sub

Sub submit(s As Object, e As EventArgs)
lbl2.Text="Hello World!"
End Sub

<form runat="server">
<h3><asp:label id="lbl1" runat="server" /></h3>
<h3><asp:label id="lbl2" runat="server" /></h3>
<asp:button text="Submit" onclick="submit" runat="server" />

thats it

Thanks & Regards,

Mark if the answer is true
Author: Narayanan             
Posted Date: August 16, 2011     Points: 20   


Regards, Lakshmi Naraayanan.S

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend