This is a migrated thread and some comments may be shown as answers.

Change DropDownList from client

2 Answers 38 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 21 Jan 2014, 11:57 PM
Hi, is it possible to change the selected index from javascript? I can't see it in the doco. Daniel.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 22 Jan 2014, 04:22 AM
Hi Daniel,

Please have a look into the sample code snippet to change the RadDropDownList item from the client side.

ASPX:
<telerik:RadDropDownList ID="RadDropDownList1" runat="server">
    <Items>
        <telerik:DropDownListItem Text="Item1" />
        <telerik:DropDownListItem Text="Item2" />
        <telerik:DropDownListItem Text="Item3" />
        <telerik:DropDownListItem Text="Item4" />
    </Items>
</telerik:RadDropDownList>

JavaScript:
<script type="text/javascript">
    function pageLoad() {
        var index = 2; // index of the dropdownlistitem want to select
        var list = $find("<%=RadDropDownList1.ClientID %>");
        list.get_items().getItem(index).select();
    }
</script>

Hope this will helps you.
Thanks,
Princy.
0
Daniel
Top achievements
Rank 1
answered on 22 Jan 2014, 04:28 AM
Thanks Princy.
Tags
DropDownList
Asked by
Daniel
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Share this question
or