$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
DropDownList Server Side Event in ASP.NET
Home > How to > DropDownList Server Event

Generally speaking, the DropDownList server events of KT.UI for ASP.NET AJAX occur and start to respond to server events fired by complex operations, which cannot be performed by invoking client side events. These events allow users to implement server ide codes on DropDownList control within web ASP.NET application. KT.UI Web ASP.NET DropDownList components supports following three server side events:
  • SelectedIndexChanged: this event will fire when the SelectedIndex event has just changed.
  • ItemSelected: this event will happen if an item from the dropdownlist has been selected.
  • ItemDataBound: this event can occur when each item is bound to a data value.
Please note that: the SelectedIndexChanged event and ItemSelected event can be fired only when users set the AutoPostBack property as True.
In following texts, users can get the composite ASP.NET and C# sample codes for setting these three DropDownList server side events.

How to Set DropDownList Server Events

Example ASPX and C# codes below are used to demonstrate how to set the supported three DropDownList server events within Web ASP.NET project by using KT.UI DropDownList control for ASP.NET AJAX.

ASPX Codes for DropDownList Server Events

Please refer following ASPX demo codes to set the supportable three DropDownList server events within web ASP.NET developing application.

<kettic:PerDropDownList ID="PerDropDownList1" runat="server" AutoPostBack="true" DefaultMessage="Select a continent..."
OnItemSelected="PerDropDownList1_ItemSelected" OnSelectedIndexChanged="PerDropDownList1_SelectedIndexChanged">
</kettic:PerDropDownList>

C# Demo Codes for Configuring DropDownList Server Events

Sample C# codes are for setting and customizing the supportable three DropDownList server events within web C# ASP.NET programming project.

protected void PerDropDownList1_ItemSelected(object sender, DropDownListEventArgs e)
{
if (PerDropDownList1.SelectedItem != null)
{
EventLogConsole1.Text+=String.Format("ItemSelected event is fired, currently selected item: '{0}'<br>", PerDropDownList1.SelectedItem.Text);
}
}
protected void PerDropDownList1_SelectedIndexChanged(object sender, DropDownListEventArgs e)
{
if (PerDropDownList1.SelectedItem != null)
{

EventLogConsole1.Text += String.Format("SelectedIndexChanged event is fired, currently selected item: '{0}'<br>", PerDropDownList1.SelectedItem.Text);
}
}

Find Other Related Online Tutorials

This page mainly focuses on DropDownList server side events and how to set these three events by using KT.UI for ASP.NET DropDownList Controls within ASP.NET project, for further operations on DropDownList component client side events and server side templates, users can get more guides via following recommended tutorials.
ASP.NET AJAX UI Controls