SlideShare a Scribd company logo
Event handling ASP.net
Brought to you by www.SiryMedia.in
• An event is an action or occurrence such as a mouse click, a key press, mouse
movements, or any system-generated notification. A process communicates
through events. For example, interrupts are system-generated events. When
events occur, the application should be able to respond to it and manage it.
• Events in ASP.NET raised at the client machine, and handled at the server
machine. For example, a user clicks a button displayed in the browser. A Click
event is raised. The browser handles this client-side event by posting it to the
server.
• The server has a subroutine describing what to do when the event is raised; it
is called the event-handler. Therefore, when the event message is transmitted
to the server, it checks whether the Click event has an associated event
handler. If it has, the event handler is executed.
Event Arguments
• ASP.NET event handlers generally take two parameters and return void. The first
parameter represents the object raising the event and the second parameter is event
argument.
• The general syntax of an event is:
• private void EventName (object sender, EventArgs e);Application and Session Events
• The most important application events are:
• Application_Start - It is raised when the application/website is started.
• Application_End - It is raised when the application/website is stopped.
• Similarly, the most used Session events are:
• Session_Start - It is raised when a user first requests a page from the application.
• Session_End - It is raised when the session ends.
Page and Control Events
• Common page and control events are:
• DataBinding - It is raised when a control binds to a data source.
• Disposed - It is raised when the page or the control is released.
• Error - It is a page event, occurs when an unhandled exception is thrown.
• Init - It is raised when the page or the control is initialized.
• Load - It is raised when the page or a control is loaded.
• PreRender - It is raised when the page or the control is to be rendered.
• Unload - It is raised when the page or control is unloaded from memory.
Event Handling Using Controls
• All ASP.NET controls are implemented as classes, and they have events which are fired when a
user performs a certain action on them. For example, when a user clicks a button the 'Click' event
is generated. For handling events, there are in-built attributes and event handlers. Event handler
is coded to respond to an event, and take appropriate action on it.
• By default, Visual Studio creates an event handler by including a Handles clause on the Sub
procedure. This clause names the control and event that the procedure handles.
• The ASP tag for a button control:
• <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
• The event handler for the Click event:
• Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs)
• Handles btnCancel.Click
• End Sub
• An event can also be coded without Handles clause. Then, the
handler must be named according to the appropriate event
attribute of the control.
• The ASP tag for a button control:
• <asp:Button ID="btnCancel" runat="server" Text="Cancel"
Onclick="btnCancel_Click" />
• The event handler for the Click event:
• Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As
System.EventArgs) End Sub
The common control events are:
Event Attribute Controls
Click OnClick Button, image button, link button, image map
Command OnCommand Button, image button, link button
TextChanged OnTextChanged Text box
SelectedIndexChanged OnSelectedIndexChanged Drop-down list, list box, radio button list, check
box list.
CheckedChanged OnCheckedChanged Check box, radio button
• Some events cause the form to be posted back to the
server immediately, these are called the postback events.
For example, the click event such as, Button.Click.
• Some events are not posted back to the server immediately,
these are called non-postback events.
• For example, the change events or selection events such as
TextBox.TextChanged or CheckBox.CheckedChanged. The
nonpostback events could be made to post back
immediately by setting their AutoPostBack property to true.
Default Events
• The default event for the Page object is Load event.
Similarly, every control has a default event. For example,
default event for the button control is the Click event.
• The default event handler could be created in Visual Studio,
just by double clicking the control in design view. The
following table shows some of the default events for
common controls:
Control Default Event
AdRotator AdCreated
BulletedList Click
Button Click
Calender SelectionChanged
CheckBox CheckedChanged
CheckBoxList SelectedIndexChanged
DataGrid SelectedIndexChanged
DataList SelectedIndexChanged
DropDownList SelectedIndexChanged
HyperLink Click
ImageButton Click
ImageMap Click
LinkButton Click
ListBox SelectedIndexChanged
Menu MenuItemClick
RadioButton CheckedChanged
RadioButtonList SelectedIndexChanged
Thank You
For more updates subscribe to our YouTube channel
SiryMedia
To watch more videos visit our website
www.sirymedia.in
Ad

More Related Content

What's hot (20)

Creational pattern
Creational patternCreational pattern
Creational pattern
Himanshu
 
C# Exceptions Handling
C# Exceptions Handling C# Exceptions Handling
C# Exceptions Handling
sharqiyem
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
Ranjuma Shubhangi
 
Java swing
Java swingJava swing
Java swing
Apurbo Datta
 
JAVA AWT
JAVA AWTJAVA AWT
JAVA AWT
shanmuga rajan
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET framework
Richa Handa
 
Unit 5
Unit 5Unit 5
Unit 5
GunasundariSelvaraj
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.net
MUKALU STEVEN
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
Spotle.ai
 
Operators in java
Operators in javaOperators in java
Operators in java
Then Murugeshwari
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
Confiz
 
Features of java
Features of javaFeatures of java
Features of java
WILLFREDJOSE W
 
Event handling
Event handlingEvent handling
Event handling
swapnac12
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | Edureka
Edureka!
 
Introduction to java beans
Introduction to java beansIntroduction to java beans
Introduction to java beans
Hitesh Parmar
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
priya Nithya
 
Notification android
Notification androidNotification android
Notification android
ksheerod shri toshniwal
 
Java applet - java
Java applet - javaJava applet - java
Java applet - java
Rubaya Mim
 
Event handling
Event handlingEvent handling
Event handling
Shree M.L.Kakadiya MCA mahila college, Amreli
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Ajay Sharma
 
Creational pattern
Creational patternCreational pattern
Creational pattern
Himanshu
 
C# Exceptions Handling
C# Exceptions Handling C# Exceptions Handling
C# Exceptions Handling
sharqiyem
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET framework
Richa Handa
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.net
MUKALU STEVEN
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
Spotle.ai
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
Confiz
 
Event handling
Event handlingEvent handling
Event handling
swapnac12
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | Edureka
Edureka!
 
Introduction to java beans
Introduction to java beansIntroduction to java beans
Introduction to java beans
Hitesh Parmar
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
priya Nithya
 
Java applet - java
Java applet - javaJava applet - java
Java applet - java
Rubaya Mim
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
Ajay Sharma
 

Similar to Asp.net event handler (20)

Events1
Events1Events1
Events1
Nuha Noor
 
ASP.NET Session 6
ASP.NET Session 6ASP.NET Session 6
ASP.NET Session 6
Sisir Ghosh
 
File Handling
File HandlingFile Handling
File Handling
Sohanur63
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
WebStackAcademy
 
tL20 event handling
tL20 event handlingtL20 event handling
tL20 event handling
teach4uin
 
event-handling.pptx
event-handling.pptxevent-handling.pptx
event-handling.pptx
usvirat1805
 
Event driven architecture
Event driven architectureEvent driven architecture
Event driven architecture
Vinod Wilson
 
cse581_03_EventProgramming.ppt
cse581_03_EventProgramming.pptcse581_03_EventProgramming.ppt
cse581_03_EventProgramming.ppt
tadudemise
 
5809566 programming concepts in vasters
5809566  programming concepts in vasters5809566  programming concepts in vasters
5809566 programming concepts in vasters
ag3777499
 
2310 b 05
2310 b 052310 b 05
2310 b 05
Krazy Koder
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
PERKYTORIALS
 
EventListenerInAndroidDevelopmentII.pptx
EventListenerInAndroidDevelopmentII.pptxEventListenerInAndroidDevelopmentII.pptx
EventListenerInAndroidDevelopmentII.pptx
ridzah12
 
PROGRAMMING IN JAVA- unit 4-part II
PROGRAMMING IN JAVA- unit 4-part IIPROGRAMMING IN JAVA- unit 4-part II
PROGRAMMING IN JAVA- unit 4-part II
SivaSankari36
 
Event Handling in Java
Event Handling in JavaEvent Handling in Java
Event Handling in Java
Ayesha Kanwal
 
Event+driven+programming key+features
Event+driven+programming key+featuresEvent+driven+programming key+features
Event+driven+programming key+features
Faisal Aziz
 
Chap - 2 - Event Handling.pptx
Chap - 2 - Event Handling.pptxChap - 2 - Event Handling.pptx
Chap - 2 - Event Handling.pptx
TadeseBeyene
 
Page life cycle IN ASP.NET
Page life cycle IN ASP.NETPage life cycle IN ASP.NET
Page life cycle IN ASP.NET
Sireesh K
 
JavaScript_Events.pptx
JavaScript_Events.pptxJavaScript_Events.pptx
JavaScript_Events.pptx
Yagna15
 
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
JAVA PROGRAMMING- GUI Programming with Swing - The Swing ButtonsJAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
Jyothishmathi Institute of Technology and Science Karimnagar
 
Chapter 8 event Handling.ppt m m m m m m
Chapter 8 event Handling.ppt m m m m m mChapter 8 event Handling.ppt m m m m m m
Chapter 8 event Handling.ppt m m m m m m
zmulani8
 
ASP.NET Session 6
ASP.NET Session 6ASP.NET Session 6
ASP.NET Session 6
Sisir Ghosh
 
File Handling
File HandlingFile Handling
File Handling
Sohanur63
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
WebStackAcademy
 
tL20 event handling
tL20 event handlingtL20 event handling
tL20 event handling
teach4uin
 
event-handling.pptx
event-handling.pptxevent-handling.pptx
event-handling.pptx
usvirat1805
 
Event driven architecture
Event driven architectureEvent driven architecture
Event driven architecture
Vinod Wilson
 
cse581_03_EventProgramming.ppt
cse581_03_EventProgramming.pptcse581_03_EventProgramming.ppt
cse581_03_EventProgramming.ppt
tadudemise
 
5809566 programming concepts in vasters
5809566  programming concepts in vasters5809566  programming concepts in vasters
5809566 programming concepts in vasters
ag3777499
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
PERKYTORIALS
 
EventListenerInAndroidDevelopmentII.pptx
EventListenerInAndroidDevelopmentII.pptxEventListenerInAndroidDevelopmentII.pptx
EventListenerInAndroidDevelopmentII.pptx
ridzah12
 
PROGRAMMING IN JAVA- unit 4-part II
PROGRAMMING IN JAVA- unit 4-part IIPROGRAMMING IN JAVA- unit 4-part II
PROGRAMMING IN JAVA- unit 4-part II
SivaSankari36
 
Event Handling in Java
Event Handling in JavaEvent Handling in Java
Event Handling in Java
Ayesha Kanwal
 
Event+driven+programming key+features
Event+driven+programming key+featuresEvent+driven+programming key+features
Event+driven+programming key+features
Faisal Aziz
 
Chap - 2 - Event Handling.pptx
Chap - 2 - Event Handling.pptxChap - 2 - Event Handling.pptx
Chap - 2 - Event Handling.pptx
TadeseBeyene
 
Page life cycle IN ASP.NET
Page life cycle IN ASP.NETPage life cycle IN ASP.NET
Page life cycle IN ASP.NET
Sireesh K
 
JavaScript_Events.pptx
JavaScript_Events.pptxJavaScript_Events.pptx
JavaScript_Events.pptx
Yagna15
 
Chapter 8 event Handling.ppt m m m m m m
Chapter 8 event Handling.ppt m m m m m mChapter 8 event Handling.ppt m m m m m m
Chapter 8 event Handling.ppt m m m m m m
zmulani8
 
Ad

More from Sireesh K (20)

Cn10
Cn10Cn10
Cn10
Sireesh K
 
chanakya neeti
chanakya neetichanakya neeti
chanakya neeti
Sireesh K
 
chanakya neeti
chanakya neetichanakya neeti
chanakya neeti
Sireesh K
 
What is mvc
What is mvcWhat is mvc
What is mvc
Sireesh K
 
31c
31c31c
31c
Sireesh K
 
31cs
31cs31cs
31cs
Sireesh K
 
45c
45c45c
45c
Sireesh K
 
44c
44c44c
44c
Sireesh K
 
43c
43c43c
43c
Sireesh K
 
42c
42c42c
42c
Sireesh K
 
41c
41c41c
41c
Sireesh K
 
40c
40c40c
40c
Sireesh K
 
39c
39c39c
39c
Sireesh K
 
38c
38c38c
38c
Sireesh K
 
37c
37c37c
37c
Sireesh K
 
35c
35c35c
35c
Sireesh K
 
34c
34c34c
34c
Sireesh K
 
33c
33c33c
33c
Sireesh K
 
30c
30c30c
30c
Sireesh K
 
29c
29c29c
29c
Sireesh K
 
Ad

Recently uploaded (20)

How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
The History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptxThe History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
*"The Segmented Blueprint: Unlocking Insect Body Architecture"*.pptx
*"The Segmented Blueprint: Unlocking Insect Body Architecture"*.pptx*"The Segmented Blueprint: Unlocking Insect Body Architecture"*.pptx
*"The Segmented Blueprint: Unlocking Insect Body Architecture"*.pptx
Arshad Shaikh
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Cultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptxCultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptx
UmeshTimilsina1
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
*"The Segmented Blueprint: Unlocking Insect Body Architecture"*.pptx
*"The Segmented Blueprint: Unlocking Insect Body Architecture"*.pptx*"The Segmented Blueprint: Unlocking Insect Body Architecture"*.pptx
*"The Segmented Blueprint: Unlocking Insect Body Architecture"*.pptx
Arshad Shaikh
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Cultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptxCultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptx
UmeshTimilsina1
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 

Asp.net event handler

  • 1. Event handling ASP.net Brought to you by www.SiryMedia.in
  • 2. • An event is an action or occurrence such as a mouse click, a key press, mouse movements, or any system-generated notification. A process communicates through events. For example, interrupts are system-generated events. When events occur, the application should be able to respond to it and manage it. • Events in ASP.NET raised at the client machine, and handled at the server machine. For example, a user clicks a button displayed in the browser. A Click event is raised. The browser handles this client-side event by posting it to the server. • The server has a subroutine describing what to do when the event is raised; it is called the event-handler. Therefore, when the event message is transmitted to the server, it checks whether the Click event has an associated event handler. If it has, the event handler is executed.
  • 3. Event Arguments • ASP.NET event handlers generally take two parameters and return void. The first parameter represents the object raising the event and the second parameter is event argument. • The general syntax of an event is: • private void EventName (object sender, EventArgs e);Application and Session Events • The most important application events are: • Application_Start - It is raised when the application/website is started. • Application_End - It is raised when the application/website is stopped. • Similarly, the most used Session events are: • Session_Start - It is raised when a user first requests a page from the application. • Session_End - It is raised when the session ends.
  • 4. Page and Control Events • Common page and control events are: • DataBinding - It is raised when a control binds to a data source. • Disposed - It is raised when the page or the control is released. • Error - It is a page event, occurs when an unhandled exception is thrown. • Init - It is raised when the page or the control is initialized. • Load - It is raised when the page or a control is loaded. • PreRender - It is raised when the page or the control is to be rendered. • Unload - It is raised when the page or control is unloaded from memory.
  • 5. Event Handling Using Controls • All ASP.NET controls are implemented as classes, and they have events which are fired when a user performs a certain action on them. For example, when a user clicks a button the 'Click' event is generated. For handling events, there are in-built attributes and event handlers. Event handler is coded to respond to an event, and take appropriate action on it. • By default, Visual Studio creates an event handler by including a Handles clause on the Sub procedure. This clause names the control and event that the procedure handles. • The ASP tag for a button control: • <asp:Button ID="btnCancel" runat="server" Text="Cancel" /> • The event handler for the Click event: • Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) • Handles btnCancel.Click • End Sub
  • 6. • An event can also be coded without Handles clause. Then, the handler must be named according to the appropriate event attribute of the control. • The ASP tag for a button control: • <asp:Button ID="btnCancel" runat="server" Text="Cancel" Onclick="btnCancel_Click" /> • The event handler for the Click event: • Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) End Sub
  • 7. The common control events are: Event Attribute Controls Click OnClick Button, image button, link button, image map Command OnCommand Button, image button, link button TextChanged OnTextChanged Text box SelectedIndexChanged OnSelectedIndexChanged Drop-down list, list box, radio button list, check box list. CheckedChanged OnCheckedChanged Check box, radio button
  • 8. • Some events cause the form to be posted back to the server immediately, these are called the postback events. For example, the click event such as, Button.Click. • Some events are not posted back to the server immediately, these are called non-postback events. • For example, the change events or selection events such as TextBox.TextChanged or CheckBox.CheckedChanged. The nonpostback events could be made to post back immediately by setting their AutoPostBack property to true.
  • 9. Default Events • The default event for the Page object is Load event. Similarly, every control has a default event. For example, default event for the button control is the Click event. • The default event handler could be created in Visual Studio, just by double clicking the control in design view. The following table shows some of the default events for common controls:
  • 10. Control Default Event AdRotator AdCreated BulletedList Click Button Click Calender SelectionChanged CheckBox CheckedChanged CheckBoxList SelectedIndexChanged DataGrid SelectedIndexChanged DataList SelectedIndexChanged DropDownList SelectedIndexChanged
  • 11. HyperLink Click ImageButton Click ImageMap Click LinkButton Click ListBox SelectedIndexChanged Menu MenuItemClick RadioButton CheckedChanged RadioButtonList SelectedIndexChanged
  • 12. Thank You For more updates subscribe to our YouTube channel SiryMedia To watch more videos visit our website www.sirymedia.in
  翻译: