I set the selected item using the first code block below. But I need to pass the item and items value to the selected event function. Which is the second code block below. i also included the code for the Dropdownlist, the third code block. How do I do this? Thanks
function onIncDataBound() {
var dropdownlist = $("#IncludeExclude").data("kendoDropDownList");
if (dropdownlist.dataSource.data().length == 1) {
debugger;
var items = $("li.k-state-selected", $("#IncludeExclude-list"));
dropdownlist.trigger("select", { item: items, value: dropdownlist.text() });
}
}
function onInExSelect(e) {
debugger;
var projSq = '@Model.Project.ProjSq';
var typeDol = $('#type').val();
var county = $('#county').val();
var dataItem = this.dataItem(e.item);
var incExc = dataItem.Value;
var Url = '@Url.Action("GetDecision", "Shared")';
$.ajax({
url: Url,
type: 'GET',
dataType: 'HTML',
data: { cnty: county, projSq: projSq, includeExclude: incExc, type: typeDol }
})
@(Html.Kendo().DropDownListFor(d => d.RequestFlatten.IncludeExclude)
.Name("IncludeExclude")
.HtmlAttributes(new { style = "width:450px" })
.OptionLabel("Select Include/Exclude")
.DataTextField("Description")
.DataValueField("Value")
.CascadeFromField("Type")
.Events(e => e.Select("onInExSelect").DataBound("onIncDataBound"))
.CascadeFrom("FdolTypeCode")
.AutoBind(false)
.Enable(false)
.DataSource(ds => ds.Read(r => r.Action("GetIncludeExcludeByCountyAndType", "Shared").Data("filterIncludeEx"))
.ServerFiltering(true)))
@Html.HiddenFor(h => h.RequestFlatten.IncludeExclude, new { id = "incExc" })