Presentation is loading. Please wait.

Presentation is loading. Please wait.

 ASP.NET provides an event based programming model that simplifies web programming  All GUI applications are incomplete without enabling actions  These.

Similar presentations


Presentation on theme: " ASP.NET provides an event based programming model that simplifies web programming  All GUI applications are incomplete without enabling actions  These."— Presentation transcript:

1

2  ASP.NET provides an event based programming model that simplifies web programming  All GUI applications are incomplete without enabling actions  These actions instructs the program to act when something happens  Events can also be generated without user interactions  Event handlers are methods in an object that are executed in response to some events occurring in the application HANDLING CLIENT-SIDE EVENTS ON THE SERVER  One of the important features of the ASP.NET web form model is its ability to support client-side events through server-side code  In order to support client-side events with server-side code, the control must have a runat=“server” attribute  This attribute tells ASP.NET to create dynamic code that links the server-side code to the control

3 WEB FORM EVENT HANDLING  ASP.NET applications utilize two important types of event handlers with different applications  These are the “page load” & “click” event handlers  The “page load” event handler is triggered every time the web page is requested and loaded by the server, while the “click” event handler is triggered every time a button is clicked EVENT ARGUMENTS  The event arguments specify the data associated with an event  When an event is raised the event arguments are passed to the event handlers  With this data they have sufficient information to handle the event  The first parameter represents the object raising the event.  The second parameter return the event arguments

4 EVENT HANDLER  An Event handler is a method that performs custom actions in response to an event notification provided by the event of a class  This handler must take as parameters exactly the values that the event generates  By convention an event handler returns no data and takes two parameters  The first specifies the object on which the event occurred(the publisher of the event)  The second contains the event arguments as describe  The process of client-side event handling with server code involves two task: Defining control events & adding server side code that responds to the event  Once you define an event associated with a control, this will register the control to emit a block client-side code  You can also register a server-side event for the standard HTML by using OnServerClick

5  Once Control event has been defined you need to add a matching code block that will be executed when the client-side event is fired  All server-side events, or event handlers, have similar signature or parameter list. The parameter list consist of 2 arguments Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click End Sub

6 EventAttributeControls ClickOnClick Button, image button, link button, image map CommandOnCommandButton, image button, link button TextChangedOnTextChangedText box SelectedIndexCha nged OnSelectedIndexCha nged Drop-down list, list box, radio button list, check box list. CheckedChangedOnCheckedChangedCheck box, radio button CONTROL EVENTS


Download ppt " ASP.NET provides an event based programming model that simplifies web programming  All GUI applications are incomplete without enabling actions  These."

Similar presentations


Ads by Google