Is it possible to set the selected value/item in a Telerik RadDropDownList in Javascript?
I'm looking at the documentation .html and it seems there is no documented way to do this simple and essential task.
Is it simply not in the documentation? Tried searching the forums as well to no avail.
Is it possible to set the selected value/item in a Telerik RadDropDownList in Javascript?
I'm looking at the documentation http://www.telerik./help/aspnet-ajax/dropdownlist-clientsideprogramming-clientsidebasic.html and it seems there is no documented way to do this simple and essential task.
Is it simply not in the documentation? Tried searching the forums as well to no avail.
Share Improve this question asked Sep 30, 2013 at 18:22 user2320724user2320724 6863 gold badges10 silver badges18 bronze badges2 Answers
Reset to default 13You can use select()
or set_selected(true)
function. Here is the documentation.
<telerik:RadDropDownList ID="RadDropDownList1" runat="server">
<Items>
<telerik:DropDownListItem runat="server" Text="One" Value="1" />
<telerik:DropDownListItem runat="server" Text="Two" Value="2" />
<telerik:DropDownListItem runat="server" Text="Three" Value="3" />
</Items>
</telerik:RadDropDownList>
<script type="text/javascript">
function pageLoad() {
var dropdownlist = $find("<%= RadDropDownList1.ClientID %>");
var item = dropdownlist.findItemByValue("3");
item.select();
}
</script>
var dropdownlist = document.getElementById('<%= RadDropDownList1.ClientID %>');
if (dropdownlist != null) {
dropdownlist .children[0].children[0].innerHTML = "3 - Low";
dropdownlist .children[0].children[0].setAttribute("class", "rddlFakeInput");
}
No other solutions worked on my project !! 3 days for the item.selected = true; it's not acceptable, so JavaScript in 20 minutes