New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
ItemSelected
The ItemSelected event occurs when the user selects an item, even if the item is already selected.
The ItemSelected event does not fire unless the AutoPostBack property is True .
The ItemSelected 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 ItemSelected 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"
OnItemSelected="RadDropDownList1_ItemSelected">
</telerik:RadDropDownList>
C#
protected void RadDropDownList1_ItemSelected(object sender, DropDownListEventArgs e)
{
Label1.Text = "You selected " + e.Text + " item";
}