I'm using Kendo().DropDownList() with OptionLabel configured.
When trying to get selected item Text / Value, I'm getting incorrect values.
for example if I choose the first drop down option I'm getting the value of the option label.
if I choose the second option I'm getting the values of the first option.
@(Html.Kendo().DropDownList()
.Name("SelectedSubjectId")
.DataTextField("Text")
.DataValueField("Value")
.Filter("contains")
.OptionLabel("Select Subject")
.BindTo(Model.MailSubjectList)
.Events(events =>
{
events.Select("onSelect");
})
)
Javascript:
onSelect = function (e) {
var dataItem = this.dataItem(e.item.index());
// or even
var selectedValue = this.value()
var selectedText = this.text()
};
How can I get the correct selected value (Text / Value) ?
Thank you.