This example illustrates how to highlight/select rows according to search criteria via a custom MVC GridView callback.
- Define an external filter editor (for example, the ButtonEdit with a single button);
- Handle the client-side ASPxClientButtonEdit.ButtonClick event;
- Perform a custom GridView callback via the client-side ASPxClientGridView.PerformCallback method;
- Pass the editor's value as a parameter;
- Handle the GridViewSettings.CustomActionRouteValues.Action method and retrieve the passed parameter. In general, it is possible to use the Action method specified for all GridView callbacks (GridViewSettings.CallbackRouteValues.Action). The illustrated technique allows handling a custom GridView's callback within a separate Action method, whose signature can be different. Usually, custom callbacks are used for changing the GridView's state programmatically in a custom manner;
- Pass the retrieved value to the GridView's PartialView via the ViewData key;
- Handle the GridViewSettings.BeforeGetCallbackResult event: if the ViewData key exists, iterate trough GridView rows and select the required one via the MVCxGridView.Selection API.
- Define an external filter editor (for example, the ButtonEdit with a single button);
- Handle the client-side ASPxClientButtonEdit.ButtonClick event;
- Perform a custom GridView callback via the client-side ASPxClientGridView.PerformCallback method;
- Pass the editor's value as a parameter;
- Handle the GridViewSettings.CustomActionRouteValues.Action method and retrieve the passed parameter. In general, it is possible to use the Action method specified for all GridView callbacks (GridViewSettings.CallbackRouteValues.Action). The illustrated technique allows handling a custom GridView's callback within a separate Action method, whose signature can be different. Usually, custom callbacks are used for changing the GridView's state programmatically in a custom manner;
- Pass the retrieved value to the GridView's PartialView via the ViewData key;
- Handle the GridViewSettings.BeforeGetCallbackResult event: if the ViewData key exists, iterate trough GridView rows and select the required one via the MVCxGridView.Selection API.