Hello,
I've got an ajax bound grid that is loading based on the chosen option in a dropdownlist. I would like to pass the value of the dropdownlist along with another model parameter (the ID of the row) to the EditorTemplate but I can't seem to do this. I tried adding the IDas a Field so it would be bound to a hidden in the EditorTemplate but this doesn't seem to be working. Also not sure how to get the dropdownlist passed in to the EditorTemplate. I know how to do it for the Read method but it didn't work the same for the Create.
Here is the View:
I've got an ajax bound grid that is loading based on the chosen option in a dropdownlist. I would like to pass the value of the dropdownlist along with another model parameter (the ID of the row) to the EditorTemplate but I can't seem to do this. I tried adding the IDas a Field so it would be bound to a hidden in the EditorTemplate but this doesn't seem to be working. Also not sure how to get the dropdownlist passed in to the EditorTemplate. I know how to do it for the Read method but it didn't work the same for the Create.
Here is the View:
@{ ViewBag.Title = "PRP Members";}<h2>PRP Members</h2>@Html.Partial("_LastViewedUserFacility")<div class="filter"> <label class="filter-label" for="filter">Filter:</label> @(Html.Kendo().DropDownList() .Name("Filter") .DataTextField("Code") .DataValueField("ID") .Events(e => e.Change("onChange")) .BindTo((System.Collections.IEnumerable)ViewData["PRPs"]) )</div><br class="clear" /><br />@(Html.Kendo().Grid<PASSAdmin.ViewModels.UserFacilityAdmin.PRPMemberViewModel>() .Name("PRPMembers") .Columns(columns => { columns.Command(command => { command.Edit(); }).Width(90); columns.Bound(c => c.First_Name).Title("First Name"); columns.Bound(c => c.Last_Name).Title("Last Name"); columns.Bound(c => c.Chair); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("UserFacilityAdmin/PRPMember").Window(window => window.Width(400))) .Sortable() .AutoBind(true) .DataSource(dataSource => dataSource .Ajax() .Model(model => { model.Id(m => m.Pool_ID); model.Field(f => f.Pool_ID); }) .Create(create => create.Action("AddPRPMember", "UserFacilityAdmin")) .Read(read => read.Action("GetPRPMembers", "UserFacilityAdmin").Data("additionalData")) .Update(update => update.Action("UpdatePRPMember", "UserFacilityAdmin")) ))<script type="text/javascript">function additionalData(e) { var value = $('#Filter').data('kendoDropDownList').value(); return { prpID: value };}function onChange() { $('#PRPMembers').data('kendoGrid').dataSource.page(1);}</script>