Hello,
I've created an Index screen with a Grid, but I want to be able to fill and submit some search criteria before the Read action occurs, then use those values in the Action method on the controller. I've set auto-bind="false" for the Grid.
My Grid has a data source:
<kendo-datasource name="dataSource1" type="DataSourceTagHelperType.Ajax" server-operation="false" page-size="20">
<transport>
<read url="@Url.Action("TblPart_Read", "TblPart");" data="searchData" />
</transport>
</kendo-datasource>
function searchData() {
return {
search: $("#txtSearch").val(),
archived: $("#chArchived").prop('checked')
};
}
The searchData consists of textbox and checkbox values.
The controller action is as follows:
public async Task<ActionResult> TblPart_Read([DataSourceRequest] DataSourceRequest request)
{
var service = new TblPartService(_context);
// omitted, but this is where I will filter the result based on the searchData
return Json(result);
}
How do I:
- Make the Grid display the filtered data when the form is submitted
- Retrieve searchData in the controller action?
Many thanks,
Richard