learn event handling in asp.net through .net training

3
Learn Event Handling in ASP.NET through .NET Training Summary: Event handling is one of the most important concepts in the ASP.NET programming. Every control like button, check box etc., will trigger events in ASP that are handled by event handler methods that have a piece of code to execute when called. ************************************************** Article: ASP.NET is one of the most popular programming languages used for the development of websites and applications. These websites or applications are usually interactive and hence, their performance is widely based on the response of the actions that users take. The actions like mouse click, mouse movements, keyboard button press etc. when carried out, will trigger the events. Event is a piece of code that is executed when actions occur on objects like clicking on a button on the website with mouse (mouse click on specific website button) and many more similar to this. Event handling is one of the most important concepts in the .net programming which every dot net web developer should have the knowledge of. It’s not too difficult learning event handling concepts in .NET, but proper training however is mandatory to know the effective ways to handle events. ASP.NET training under the guidance of industry experts can help you learn the basics of the concept while teaching you the actual way to implement it practically. When a user performs an action, event is raised on the client side, while this is actually handled by the server. For example consider the two events in ASP.NET, the OnClick method & OnCheckChanged method. These are executed on the server, where the server calls subroutine including a set of code to be executed when a mouse button is clicked and when a radio button or a check box is checked. Following is the general syntax of an event handler method in ASP.NET. Here the first parameter represents the object that has generated the

Upload: neil-modi

Post on 20-Jan-2015

7.086 views

Category:

Social Media


0 download

DESCRIPTION

TOPS Technologies Leading IT Training Institute offer training in Php, .Net, Java, iPhone, Android, Software testing and SEO. By TOPS Technologies. http://www.tops-int.com

TRANSCRIPT

Page 1: Learn Event Handling in ASP.NET through .NET Training

Learn Event Handling in ASP.NET through .NET Training

Summary:Event handling is one of the most important concepts in the ASP.NET programming. Every control like button, check box etc., will trigger events in ASP that are handled by event handler methods that have a piece of code to execute when called.

**************************************************

Article:

ASP.NET is one of the most popular programming languages used for the development of websites and applications. These websites or applications are usually interactive and hence, their performance is widely based on the response of the actions that users take. The actions like mouse click, mouse movements, keyboard button press etc. when carried out, will trigger the events.

Event is a piece of code that is executed when actions occur on objects like clicking on a button on the website with mouse (mouse click on specific website button) and many more similar to this.

Event handling is one of the most important concepts in the .net programming which every dot net web developer should have the knowledge of. It’s not too difficult learning event handling concepts in .NET, but proper training however is mandatory to know the effective ways to handle events. ASP.NET training under the guidance of industry experts can help you learn the basics of the concept while teaching you the actual way to implement it practically.

When a user performs an action, event is raised on the client side, while this is actually handled by the server.

For example consider the two events in ASP.NET, the OnClick method & OnCheckChanged method. These are executed on the server, where the server calls subroutine including a set of code to be executed when a mouse button is clicked and when a radio button or a check box is checked.

Following is the general syntax of an event handler method in ASP.NET. Here the first parameter represents the object that has generated the event while the second represents the event data being sent to the server.

private void EventName (object sender, EventArgs e);

Event Handling with Controls

All the controls in ASP.NET whether a text-box, check box or drop-down list will trigger events by default when a user performs action on them. These events are generally handled by the in-built event handler methods that have a piece of code to execute when called. An event handler is coded to respond to an action and this is done in two ways generally in Visual Studio. By default, in Visual Studio an event handler including a Handles clause is created. However there could also be the one without an event handler.

Page 2: Learn Event Handling in ASP.NET through .NET Training

For example, let us consider that there is an event for mouse button click and the event Click() is generated. Then following are the codes written with and without Handles clause for the event.

ASP tag for Button Control<asp:Button ID="btnCancel" runat="server" Text="Cancel" />

Event Code for Click EventProtected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click //with handles clauseEnd Sub

ASP tag for Button Control<asp:Button ID="btnCancel" runat="server" Text="Cancel" Onclick="btnCancel_Click" />

Event Code for Click EventProtected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) //without handles clauseEnd Sub

Hence, most often for the buttons like image button, link button and image map controls, events called Click or Command will be generated that take OnClick or OnCommand attributes respectively. Apart from this there are various other controls used in ASP.NET like text box, drop-down list, check box list etc. that have different in-built events generated every time they are used. Some of the commonly generated events and their respective controls from which they are generated are shown in the below table.

Control Event generated by Default BulletedList ClickButton ClickDataGrid SelectedIndexChangedDropDownList SelectedIndexChangedHyperLink ClickImageButton ClickListBox SelectedIndexChangedMenu MenuItemClickRadioButton CheckedChangedRadioButtonList SelectedIndexChangedCheckBox CheckedChangedCheckBoxList SelectedIndexChanged

So, in order to more about the controls and the respective events required to handle the actions performed on these controls for effective .NET development, one should join ASP.NET training. Through .NET training one can learn this concept of event handling through practical methods and will

Page 3: Learn Event Handling in ASP.NET through .NET Training

also get the support of teaching experts who can clarify the doubts that may arise in the minds of the learners while practice. This is the major benefit a learner can get by joining .NET training rather than opting for other options like online learning or self learning through books.

**************************************************************************Author Box:

TOPS Technologies is one of the top IT training institutes offering the best ASP.NET training courses in Ahmedabad for freshers and students. The institute provides industry-oriented C# and ASP.Net training course and Microsoft certification .NET training for that looking build career in .NET development.