Kendo UI ASP.Net MVC ForeignKey column DataSource in InCell Edit mode -
i have kendo grid , foreignkey column on page. foreignkey column populated using viewdata described below.
column.foreignkey(x => x.productid, (list<product>)viewdata["products"], "id", "prodname");
the grid editable in batch(incell) mode show below...
.editable(editable => editable.mode(grideditmode.incell)
i want modify collection of productid column in grid after page loaded based on value selected on other drop-down defined outside of grid.
how can achieve that? can using jquery?
similar example found here... http://www.telerik.com/community/forums/aspnet-mvc/grid/cascading-dropdowns-in-grid-edit---foreignkey-columns.aspx
thanks.
i figure out on how filter product drop-down using editortemplate foreign key column. here column definition product.
c.foreignkey(x => x.productid, (list<product>)viewdata["products"], "id", "prodname").editortemplatename("productideditor");
here editor template product, productideditor.cshtml
@using kendo.mvc.ui @(html.kendo().dropdownlistfor(m => m) .autobind(false) .optionlabel("select value...") .datatextfield("prodname") .datavaluefield("id") .datasource(datasource => { datasource.read(read => read.action("filterproducts", "home").data("filterproducts")) .serverfiltering(true); }) ) @html.validationmessagefor(m => m)
in main view index.cshtml, added filterproducts javascript handler...that passes json object productid controller.
function filterchargetypes() { return { productid: $("#productid").val() }; }
here controller listens filtering event...
public actionresult filterproducts(string productid) { // filtereing based on productid. }
filterproducts called every time when user hit drop-down filtered value.
Comments
Post a Comment