如何将值设置为radcombobox [英] How to set the value into radcombobox

查看:80
本文介绍了如何将值设置为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() 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 use select() or set_selected(true) function.

Looking at your code, it seems like your are doing it right. You just have to make sure that the value of rlvControllers._dataSource[itemIndex].FORMLAYOUT that you passed in the findItemByText() method exist in your dropdownlist DataTextField or else it won't work. One thing to note that you could also use the findItemByValue() method if you want to select the value based on the dropdownlist DataValueField.


这篇关于如何将值设置为radcombobox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆