I have a view setup the following way:
@for (var i = 0; i < Model.ApprovingRoles.Count; i++)
{
<div class="col-lg-6">
@(Html.Kendo().DropDownListFor(m => m.ApprovingRoles[i])
.Size(ComponentSize.Medium)
.Rounded(Rounded.Medium)
.FillMode(FillMode.Outline)
.OptionLabel("Select " + Model.ApprovingRoles[i].Name)
.HtmlAttributes(new { style = "width: 100%", required = "required", validationmessage = "Value required" })
.DataTextField(nameof(SystemUserModel.EmployeeName))
.DataValueField(nameof(SystemUserModel.Id))
.Filter(FilterType.Contains)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetUsersByRoleId", "Api").Data(Model.ApprovingRoles[i].Id.ToString());
}).ServerFiltering(true);
})
.Height(500)
)
</div>
}
GetUsersByRoleId
API, and the value is in m.ApprovingRoles[i].Id
Currently:
I have a breakpoint on the GetUsersByRoleId and I'm just receiving a 0 for my int roleId
parameter over there.
I figured out that it is pretty easy to provide a parameter or parameters to the API call:
read.Action("GetUsersByRoleId", "Api", new { roleId = Model[index].Id });