Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

GridView - How to toggle Auto Filter Row visibility

$
0
0

This example illustrates how to toggle the Auto Filter Row visibility via a custom MVC GridView callback.

- Initialize the expected Auto Filter Row visibility via the ViewData key when a View is loaded for the first time;
- Set the CheckBox state according to the ViewData key value;
- Load the GridView's PartialView via the Html.Action method and pass the ViewData key as a parameter;
- Set the Auto Filter Row visibility according to the ViewData key;
- Handle the client-side ASPxClientCheckBox.CheckedChanged event;
- Perform a custom GridView callback via the client-side ASPxClientGridView.PerformCallback method;
- Handle the client-side ASPxClientGridView.BeginCallback event;
- Pass the CheckBox' checked state as a parameter (Passing Values to Controller Action Through Callbacks);
- 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 (like here - toggling the Auto Filter Row visibility);
- Pass the required Auto Filter Row visibility state via the ViewData key back to the GridView PartialView.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>