如何将值设置为radcombobox [英] How to set the value into radcombobox
本文介绍了如何将值设置为radcombobox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用javascript将值设置为raddropdownlist。
我尝试了什么:
var dropdownlist = $ find( <%= rcbLayout.ClientID%>);
var item = dropdownlist.findItemByText(rlvControllers._dataSource [itemIndex] .FORMLAYOUT);
item.select();
加价:
< asp:标签 ID = LayoutLabel runat = server 文字 = 表单布局: > < / asp:标签 >
< telerik:RadDropDownList RenderMode < /跨度> = 轻量级 ID = rcbLayout 宽度 = 250px DataTextField = TEXT DataValueField = VALUE runat = server > < / telerik:RadDropDownList >
解决方案
find( <%= rcbLayout.ClientID%>);
var item = dropdownlist.findItemByText(rlvControllers._dataSource [itemIndex] .FORMLAYOUT);
item.select();
加价:
< asp:标签 ID = LayoutLabel runat = server 文字 = 表单布局: > < / asp:标签 >
< telerik:RadDropDownList RenderMode < /跨度>= 轻量级 ID = rcbLayout 宽度 = 250px DataTextField = TEXT DataValueField = VALUE runat = server > < / telerik:RadDropDownList >
根据文档,您可以使用选择( )
或set_selected(true)
函数。
看看你的代码,看起来你做得对。你只需要确保你在findItemByText()$ c $中传递的
rlvControllers._dataSource [itemIndex] .FORMLAYOUT
的值c>方法存在于您的下拉列表DataTextField
中,否则它将无效。有一点需要注意的是,如果要根据下拉列表选择值,可以使用findItemByValue()
方法DataValueField
I am trying to set value to raddropdownlist using javascript.
What I have tried:
var dropdownlist = $find("<%= rcbLayout.ClientID %>");
var item = dropdownlist.findItemByText(rlvControllers._dataSource[itemIndex].FORMLAYOUT);
item.select();
markup:
<asp:Label ID="LayoutLabel" runat="server" Text="Form Layout:"></asp:Label>
<telerik:RadDropDownList RenderMode="Lightweight" ID="rcbLayout" Width="250px" DataTextField="TEXT" DataValueField="VALUE" runat="server"></telerik:RadDropDownList>
解决方案
find("<%= rcbLayout.ClientID %>"); var item = dropdownlist.findItemByText(rlvControllers._dataSource[itemIndex].FORMLAYOUT); item.select();
markup:
<asp:Label ID="LayoutLabel" runat="server" Text="Form Layout:"></asp:Label> <telerik:RadDropDownList RenderMode="Lightweight" ID="rcbLayout" Width="250px" DataTextField="TEXT" DataValueField="VALUE" runat="server"></telerik:RadDropDownList>
According to the documentation, you can useselect()
orset_selected(true)
function.
Looking at your code, it seems like your are doing it right. You just have to make sure that the value ofrlvControllers._dataSource[itemIndex].FORMLAYOUT
that you passed in thefindItemByText()
method exist in your dropdownlistDataTextField
or else it won't work. One thing to note that you could also use thefindItemByValue()
method if you want to select the value based on the dropdownlistDataValueField
.
这篇关于如何将值设置为radcombobox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文