[英]How to set value to telerik:RadAutoCompleteBox from javascript?
I am using telerik:RadAutoCompleteBox as a input element.I want to set its value from javascript on the click event of the another button.The code for the element is as follows: 我正在使用telerik:RadAutoCompleteBox作为输入元素。我想在另一个按钮的click事件上通过javascript设置其值。该元素的代码如下:
<telerik:RadAutoCompleteBox
runat="server"
ID="costCodeTxt"
Width="400"
OnClientRequesting="requesting"
DropDownWidth="300"
InputType="Text"
TextSettings-SelectionMode="Single"
OnClientTextChanged="VerifyJobCostCode">
<WebServiceSettings Path="~/QuantitySurvey/CostCode.asmx" Method="GetCostCodeList" />
</telerik:RadAutoCompleteBox>
This should work to get you to the dom element, allowing you to set the value. 这应该可以使您进入dom元素,从而可以设置值。
function setText(text){
var domElement = $find("<%= costCodeTxt.ClientID %>").get_inputElement();
domElement.value = text;
}
You probably also want to set this to allow custom text 您可能还希望将其设置为允许自定义文本
AllowCustomEntry = "true"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.