Events in ASP.NET Server Controls
Events in ASP.NET Server Controls
In this post we talk about Events in Asp.net Programming controls.when we start programming then very first and starting point is come in mind that is how to work or where we apply logic. the we have one major Question in mind.The Question is :-"What are ASP.Net Programming server controls? working ?"
Event in ASP.Net server control .Server controls have events and also have event handling system to manipulate their properties, status, and behaviors in Programming .
Events is action or behavior defined to happen under a certain condition Basic event
Life cycle of events: Every control has several stages from initiation to release.
Interaction events: usually raised by user actions, such as button click, selection or value change, etc
Event Handling
- Event handlers (methods) are the defined actions when an event is raised.
- Normally event handlers need to be registered (bound) to events
- Binding and event handler to the event.AutoEventWireUp
ASP.Net provides an automatic way to bind a default event handler to an event, using the attribute “AutoEventWireUp”
In the .aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="…" Inherits="..." %>Event handler(page load event)
void Page_Load(object sender, EventArgs e)
{
…
}
Basic Web Control Interaction in Asp.net
Events and Default Event Handler
1. Button click Event
void btn_Click(object sender, EventArgs e)here btn is Button
2. Textbox text changed Event
void Txtbox1_TextChanged(object sender, EventArgs e)
here Txtbox1 is TextBox1
3. Checkbox, radio button Event
void ch1_CheckedChanged(object sender, EventArgs e)
here ch1 is CheckBox1.
4. Dropdown list, checkbox list, radio button list Event
void ddl_SelectedIndexChanged(object sender, EventArgs e)
here ddl is DropDownList1.
5.Post back Event in .net Programming:
Post back EventRelated Post:Reference : |