我有这个组合框,我需要在客户端填充一个带有所选组合框值的文本框。我所拥有的似乎没有起作用。我这样做了吗?
<asp:ComboBox ID="cmbOutputRating" runat="server"
DropDownStyle="DropDown"
AutoCompleteMode="Suggest"
CaseSensitive="false"
RenderMode="Inline"
ItemInsertLocation="Append"
onchange="javascript:ddlChange();">
</asp:ComboBox>
这是文本框:
<asp:TextBox ID="txtOutputRating" runat="server"
CssClass="inputFieldSmall"
OnTextChanged="txtOutputRating_TextChanged"
AutoPostBack="True"
meta:resourcekey="txtOutputRatingResource1">
</asp:TextBox>
这是javascript:
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
function ddlChange()
{
var cmb = document.getElementById('<%=cmbOutputRating.ClientID %>');
var textBox = document.getElementById('<%= txtOutputRating.ClientID%>');
textBox.value = cmb.options[cmb.selectedIndex].value;
}
</script>
</asp:Content>
答案 0 :(得分:0)
组合框被渲染为输入,因此您可以像这样获取它的值:
function categoryDropDownEditor(container, options) {
var model = options.model;
var tempDataSource = new kendo.data.DataSource({
type: "odata",
transport: {
read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Categories",
parameterMap: function (options, operation) {
console.log("test",operation,operation);
if (operation == "read" && options) {
//do your condition here
if(model.UnitPrice > 20){
tempDataSource.filter({field:"CategoryName", operator:"eq", value: "Condiments"});
}
return kendo.data.transports["odata"].parameterMap(options, operation);
}
}
},
});