I'm having to dynamically create instances of the kenod dropdownlist and I have it working fine except I need to know what the equivalent syntax for defining the datasource.
Here is the razor server-side syntax:
@(Html.Kendo().DropDownList()
.Name("lineItemTypeCode")
.OptionLabel("..........")
.HtmlAttributes(new { style = "width:100%", @class = "itemTypeClass", required = "required" })
.DataValueField("Code")
.DataTextField("Name")
.DataSource(source => { source.Read(read => { read.Action("GetItemTypes", "RequestPONumber").Data("GetSelectedLocation"); }); })
)
Action is GetItemTypes
Controller is RequestPONumber
Here is my client-side:
var newItemTypeDdl = $("#itemTypeddl" + poLinesCount).kendoDropDownList(
{
dataTextField: 'Name',
dataValueField: 'Code',
dataSource: ??????,
optionLabel: "..........",
});