New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
SelectedIndexChanged
The SelectedIndexChanged event occurs when the SelectedIndex has just changed.
The SelectedIndexChanged event does not fire unless the AutoPostBack property is True .
The SelectedIndexChanged event handler receives two arguments:
-
The RadDropDownList that is loading items. This argument is of type object, but can be cast to the RadDropDownList type.
-
An EventArgs object. This object has the following properties for identifying what has changed:
-
Index is the index of the item that was just selected.
-
Text is the text of the item that was just selected.
-
Value is the value of the item that was just selected.
-
Use the SelectedIndexChanged event handler to respond in server-side code when the user changes the current selection:
ASPNET
<telerik:RadDropDownList RenderMode="Lightweight" ID="RadDropDownList1"
runat="server"
AutoPostBack="true"
OnSelectedIndexChanged="RadDropDownList1_SelectedIndexChanged">
</telerik:RadDropDownList>
C#
protected void RadDropDownList1_SelectedIndexChanged(object sender, DropDownListEventArgs e)
{
Label1.Text = "You selected " + e.Text + " item";
}