如何在组合框中获取所选项目的datavaluefield?
问题描述:
Kendo组合框不能获得项目的选定值
我尝试过的方法:
Kendo combobox can't get selected value of item
What I have tried:
@(Html.Kendo().ComboBox()
.Name("ddl" + @Model.objDllColl[i].MCLELDescription.Split(' ') [0].ToString()) //@Model.objDllColl[i].MCLELDescription.Split(' ')[0].ToString()
.HtmlAttributes(new { style = "width: 200px;" })
.Events(e =>{ e.Select("filterProducts1");//.Open("onOpen"); })
.DataValueField("MCLECECode")
.DataTextField("MCLELDescription")
.DataSource(source =>{
source.Read(read => { read.Action("_Cluster", "Cluster", new { area = "" }) .Data("filterProducts");}) .ServerFiltering(true);})
.AutoBind(true)
.ToClientTemplate()
)
function filterProducts1(e) {
debugger
alert('ertera')
var CEDCode = this.dataItem(e.item.index()).ValueField; //this.dataItem(e.item.index()).ValueField
alert(CEDCode)
}
答
尝试使用并简单化。我希望有效。
Try using and making it simple. I hope that works.
var combobox =
(#COMBOBOXNAME)。data(kendoComboBox);
combobox.value();
combobox.text()
("#COMBOBOXNAME").data("kendoComboBox"); combobox.value(); combobox.text()