Quantcast
Viewing all articles
Browse latest Browse all 7205

GridView - How to hide or show filter row menu items for a certain column


This example demonstrates how to hide or show filter row menu items for a certain column.


To do this, we assign CSS classes to:

- Filter cells using the Styles.FilterCell.CssClass property;

- Filter row menu items using the Styles.FilterRowMenuItem.CssClass property;

- Specific column's filter cell using the GridViewDataColumn.FilterCellStyle.CssClass property;


These classes will be used later to find the necessary elements:

[JScript]
$().ready(function(){ $(".filterCell").click(function(event){var hide = $(event.currentTarget).hasClass("necessaryColumn"); ManageOptions(!hide);});});function ManageOptions(visible){var value = visible ? "list-item" : "none"; $(".frmi").each(function(){var text = $(this).text().toLowerCase();if(text.indexOf("equals")>= 0 || text.indexOf("is less than")>= 0) $(this).css("display", value);});}
The element's "display" style is changed based on specific conditions.

Viewing all articles
Browse latest Browse all 7205

Trending Articles



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