@(Html.Kendo().Grid<DL.Data.PayCodes>() .Name("grdPayCodes") .Columns(columns => { columns.Bound(p => p.pay_code).Width(120).Title("Code"); columns.Bound(p => p.color).Width(75).Title("Color").ClientTemplate("<div style='width: 100%; text-align: center;'><div style='width: 25px; height: 25px; background: #=color#; -moz-border-radius: 17px; -webkit-border-radius: 17px; border-radius: 17px; margin: auto; #= SetBorder(this, color)#'></div></div>"); columns.Bound(p => p.description).Title("Description"); columns.Command(command => { command.Edit(); command.Custom("Delete").Click("DeletePayCodes_Click"); }).Width(180).HtmlAttributes(new { style = "text-align: center;" }); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("PayCodesAddRecordTemplate")) .Sortable() .Scrollable() .HtmlAttributes(new { style = "height:430px; margin-top: 7px;" }) .DataSource(dataSource => dataSource .Ajax() .Model(model => model.Id(p => p.pay_code)) .Create(update => update.Action("CreatePayCodes", "Settings")) .Read(read => read.Action("GetPayCodesDSGrid", "Common")) .Update(update => update.Action("UpdatePayCodes", "Settings")) .Events(events => events.Error("grdPayCodes_ErrorHandler").RequestEnd("grdPayCodes_RequestEnd")) ) .Events(ev => ev.DataBound("grdPayCodes_DataBound").Edit("grdPayCodes_Edit")) )<table style="margin-left: 5%; width: 90%;"> <tr> <td class="label-cell"> <label for="pay_code">Code</label> </td> <td> <input id="pay_code" name="pit_name" class="data-cell" data-bind="value: pay_code"> </td> </tr> <tr> <td class="label-cell"> <label for="color">Color</label> </td> <td> @(Html.Kendo().ColorPicker() .Name("color") .Value("#ffffff") ) </td> </tr> <tr> <td class="label-cell"> <label for="description">Description</label> </td> <td> <input id="description" name="description" class="data-cell" data-bind="value: description"> </td> </tr></table>Hi,
Is it possible to use DataSourceRequest when using a Combobox with auto suggest?
For example: I have created T4 templates for simple CRUD operations with the read action like so:
public ActionResult Read([DataSourceRequest] DataSourceRequest request)
I was hoping to use this Read method when populating comboboxes and server filtering for suggesting.
At the moment I have had to add the following action to get it to work.
public ActionResult Lookup(string text)
As the objects are small it would be great if there was a way to reuse the Read action and the ToDataSourceResult() extension to create the filters etc.
Is there a way? Am I missing something? Like a custom model binder or an extension method which takes the query string e.g “text=MySearch&filter[logic]=and&filter[filters][0][value]=dsds&filter[filters][0][field]=DisplayName&filter[filters][0][operator]=contains&filter[filters][0][ignoreCase]=true”
Thanks Matt