Edit this page

OnSelectedIndexChanged

The selectedIndexChanged event occurs when user changes the selected item in RadRadioButtonList.

The event handler receives two parameters:

  1. The instance of the loaded RadRadioButtonList control.

  2. An eventArgs parameter of type Telerik.Web.UI.ButtonListSelectedIndexChangedEventArgs, containing the following properties and methods:

    • get_oldSelectedIndex() - returns the index of the previously selected item.
    • get_newSelectedIndex() - returns the index of the currently selected item.

Example 1: Handling RadRadioButtonList OnSelectedIndexChanged event.

<script type="text/javascript">
    function OnSelectedIndexChanged(sender, args) {
        var oldItem = sender.get_items()[args.get_oldSelectedIndex()];
        var newItem = sender.get_items()[args.get_newSelectedIndex()];
        alert("You changed from " + oldItem.get_text() + " to " + newItem.get_text() + " language.");
    }
</script>

<telerik:RadRadioButtonList runat="server" ID="RadRadioButtonList1">
    <ClientEvents OnSelectedIndexChanged="OnSelectedIndexChanged" />
    <Items>
        <telerik:RadioButtonListItem Text="English" Selected="true" />
        <telerik:RadioButtonListItem Text="German" />
        <telerik:RadioButtonListItem Text="French" />
    </Items>
</telerik:RadRadioButtonList>

See Also