{"id":372,"date":"2010-08-25T15:02:00","date_gmt":"2010-08-25T15:02:00","guid":{"rendered":"https:\/\/staging.infragistics.com\/blogs\/?p=372"},"modified":"2025-02-26T10:38:28","modified_gmt":"2025-02-26T10:38:28","slug":"webdatagrid-css-styling-guide","status":"publish","type":"post","link":"https:\/\/www.infragistics.com\/blogs\/webdatagrid-css-styling-guide","title":{"rendered":"WebDataGrid CSS Styling Guide"},"content":{"rendered":"\n<p>WebDataGrid CSS Styling Guide provides guidelines for customizing the appearance of the WebDataGrid using CSS. It covers modifying colors, fonts, cell sizes, borders, backgrounds, and animations, as well as applying custom classes to enhance the user experience.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"styling-webdatagrid\">Styling WebDataGrid<\/h2>\n\n\n\n<p><strong>1. CSS Classes applied from control level<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>CssClass&nbsp;\u2013 applied to the grid\u2019s frame.<\/li>\n\n\n\n<li>HeaderCaptionCssClass&nbsp;\u2013 applied to the header caption of every column.<\/li>\n\n\n\n<li>ItemCssClass&nbsp;\u2013 applied to every row.<\/li>\n\n\n\n<li>AltItemCssClass&nbsp;\u2013 applied to every even row.<\/li>\n\n\n\n<li>FooterCaptionCssClass&nbsp;\u2013 applied to the footer caption of every column.<\/li>\n<\/ol>\n\n\n\n<p><strong>2. CSS Classes applied from column level<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Header-CssClass&nbsp;\u2013 applied to the column Header.<\/li>\n\n\n\n<li>CssClass&nbsp;\u2013 applied to every&nbsp;cell in the column.<\/li>\n\n\n\n<li>Footer-CssClass\u2013 applied to the column Footer<\/li>\n<\/ol>\n\n\n\n<p><strong>Note:<\/strong>&nbsp;The classes that are&nbsp;applied on the column level would&nbsp;overwrite those&nbsp;on the&nbsp;control level.<br><br><strong>3. CSS Classes applied from behavior levels<br><\/strong><br><strong>3.1. Activation<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>ActiveCellCssClass&nbsp;\u2013 applied to the active cell.<\/li>\n\n\n\n<li>ActiveColumnCssClass&nbsp;\u2013 applied to the&nbsp;column\u2019s header of the active cell.<\/li>\n\n\n\n<li>ActiveRowCssClass&nbsp;\u2013 applied to the row of the active cell.<\/li>\n\n\n\n<li>ActiveRowSelectorCssClass&nbsp;\u2013 applied to the RowSelector of the active cell.<\/li>\n\n\n\n<li>ActiveRowSelectorImageCssClass&nbsp;\u2013 applied to the image area of the RowSelector of the active cell.<\/li>\n<\/ol>\n\n\n\n<p><strong>3.2. Column fixing<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>CellCssClass&nbsp;\u2013 applied to fixed column cells.<\/li>\n\n\n\n<li>FooterCssClass&nbsp;\u2013 applied to fixed&nbsp;column footers.<\/li>\n\n\n\n<li>HeaderCssClass&nbsp;\u2013&nbsp;applied to fixed&nbsp;column headers.<\/li>\n\n\n\n<li>SeparatorCssClass&nbsp;\u2013 applied to the separator line that separates fixed columns from regular columns.<\/li>\n<\/ol>\n\n\n\n<p><strong>3.3. Column moving<\/strong>&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>TopDragIndicatorCssClass&nbsp;\u2013 applied to the top portion of the drop indicator.<\/li>\n\n\n\n<li>MiddleDragIndicatorCssClass&nbsp;\u2013&nbsp;applied to the middle portion of the drop indicator.<\/li>\n\n\n\n<li>BottomDragIndicatorCssClass&nbsp;\u2013 applied to the bottom portion of the drop indicator.<\/li>\n\n\n\n<li>DragMarkupCssClass&nbsp;\u2013 applied to the DragMarkup. If the default drag markup is used, this class will be applied in addition to the styles already applied to the header, if the drag markup is replaced only the DragMarkupCssClass will be used.<br><\/li>\n<\/ol>\n\n\n\n<p><strong>3.4. Column resizing<\/strong>&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>ResizeIndicatorCssClass&nbsp;\u2013&nbsp;applied to the resize indicator line<\/li>\n<\/ol>\n\n\n\n<p><strong>3.5.&nbsp;Editing<\/strong>&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>EditCellCssClass&nbsp;\u2013 applied to the cell that is being edited.<\/li>\n\n\n\n<li>AddNewRowCssClass&nbsp;\u2013 applied to the AddNewRow.<\/li>\n\n\n\n<li>AddNewRowSelectorImageCssClass&nbsp;\u2013&nbsp;applied to the image area of the RowSelector of the AddNewRow.<\/li>\n<\/ol>\n\n\n\n<p><strong>3.6.&nbsp;Filtering<\/strong>&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>EditCellCssClass&nbsp;\u2013 applied to the filter cell that is being edited.<\/li>\n\n\n\n<li>FilterButtonCssClass&nbsp;\u2013 applied to the filer button.<\/li>\n\n\n\n<li>FilteringCssClass&nbsp;\u2013 applied to the filter row.<\/li>\n\n\n\n<li>FilterRowSelectorImageCssClass&nbsp;\u2013 applied to the image area of the RowSelector of the filter row.<\/li>\n\n\n\n<li>FilterRuleDropDownCssClass&nbsp;\u2013 applied to the filter rule drop down.<\/li>\n\n\n\n<li>FilterRuleDropDownHoverItemCssClass&nbsp;\u2013 applied to the hovered item of the filter rule drop down.<\/li>\n\n\n\n<li>FilterRuleDropDownItemCssClass&nbsp;\u2013 applied to the items of the filter rule drop down.<\/li>\n\n\n\n<li>FilterRuleDropDownSelectedItemCssClass&nbsp;\u2013 applied to the selected item of the filter rule drop down.<\/li>\n<\/ol>\n\n\n\n<p><strong>3.7.&nbsp;Paging<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>PagerCssClass&nbsp;\u2013 applied to the pager frame.<\/li>\n\n\n\n<li>CurrentPageLinkCssClass&nbsp;\u2013 applied to the current page index in the&nbsp;numeric mode.<\/li>\n\n\n\n<li>PageLinkCssClass&nbsp;\u2013 applied to pager\u2019s index links other than the current one in the&nbsp;numeric mode.<\/li>\n<\/ol>\n\n\n\n<p>&nbsp;<strong>3.8.&nbsp;Row Selectors<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>HeaderRowSelectorCssClass&nbsp;\u2013 applied to the row selector of the header row.<\/li>\n\n\n\n<li>FooterRowSelectorCssClass&nbsp;\u2013 applied to the row selector of the footer row.<\/li>\n\n\n\n<li>RowSelectorCssClass&nbsp;\u2013 applied to row selectors.<\/li>\n<\/ol>\n\n\n\n<p>&nbsp;&nbsp;<strong>3.8.&nbsp;Selection<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/www.infragistics.com\/cfs-file.ashx\/__key\/CommunityServer.Blogs.Components.WeblogFiles\/engineering\/s11.png\"><\/a><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>SelectedHeaderCssClass&nbsp;\u2013 applied to the column header when a column is selected<\/li>\n\n\n\n<li>SelectedCellCssClass&nbsp;\u2013 applied to the&nbsp;cell that is selected.<\/li>\n\n\n\n<li>SelectedRowSelectorCssClass&nbsp;\u2013 applied to the row selector when a row is selected.<\/li>\n\n\n\n<li>SelectedRowSelectorImageCssClass&nbsp;\u2013 applied to the row selector image when a row is selected.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"using-css-selectors\">Using CSS selectors<\/h2>\n\n\n\n<p>CSS classes are applied to every cell of WebDataGrid. So let\u2019s imagine that we have a grid with a&nbsp;lot of&nbsp;records &#8211; this means that we have to apply one css class&nbsp;that many&nbsp;times. Doing so will significantly enlarge the HTML that needs to be rendered which inevitably lowers the performance. To avoid this, WebDataGrid uses CSS selectors.<\/p>\n\n\n\n<p>For example, there is this default CSS class called&nbsp;<em>igg_Item,&nbsp;<\/em>which needs to be applied to every cell. Here is how it is done:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tbody.Igg_Item > tr > td\n{\n     \/* style *\/\n}<\/pre>\n\n\n\n<p>The same pattern should be used for applying custom CSS classes.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>For any CSS class that targets cells in the body the CSS class should be written as following:<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tbody.NewCellClass > tr > td\n{\n    \/*styles*\/\n}<\/pre>\n\n\n\n<p>It is applicable to control level\u2019s ItemCssClass property, and to the column fixing behavior&#8217;s CellCssClass.<\/p>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li> For any other classes that target specific cells in the grid the selectors should be used&nbsp;as following:<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tbody > tr > td.NewCellClass\n{\n    \/*styles*\/\n}<\/pre>\n\n\n\n<p>It is applicable to the these properties: &nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>column level: CssClass<\/li>\n\n\n\n<li>activation behavior: ActiveCellCssClass<\/li>\n\n\n\n<li>selection behavior: SelectedCellCssClass<\/li>\n<\/ul>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>For any CSS class that targets a row the CSS class should be written as following:<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tbody > tr.NewRowCssClass > td\n{\n    \/*styles*\/\n}<\/pre>\n\n\n\n<p>It is applicable to the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>control level: &nbsp; AltItemCssClass<\/li>\n\n\n\n<li>activation behavior: ActiveRowCssClass<\/li>\n<\/ul>\n\n\n\n<p>The following code shows how to apply different styles to the grid cells.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;style type=\"text\/css\">\n        .HeaderCaptionClass\n        {\n            text-align: center;\n        }\n        tbody.NewItemClass > tr > td\n        {\n            color: blue;\n            text-align: center;\n        }\n        tbody > tr.ActiveRowClass > td\n        {\n            background-color: Red;\n        }\n        tbody > tr > td.ColumnLevelCssClass\n        {\n            text-decoration: underline;\n        }\n        tbody > tr > td.SelectedCellClass\n        {\n            font-weight: bold;\n        }\n        tbody > tr > td.ActiveCellClass\n        {\n            background-color: Yellow;\n        }\n&lt;\/style><\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;ig:WebDataGrid runat=\"server\" ID=\"wdgCustomers\" DataSourceID=\"AccessDsCustomers\"\n        HeaderCaptionCssClass=\"HeaderCaptionClass\" DataKeyFields=\"CustomerID\" AutoGenerateColumns=\"false\"\n        Width=\"88%\" ItemCssClass=\"NewItemClass\" Height=\"400\">\n        &lt;Columns>\n            &lt;ig:BoundDataField CssClass=\"ColumnLevelCssClass\" Key=\"Country\" DataFieldName=\"Country\"\n                Header-Text=\"Country\" \/>\n            &lt;ig:BoundDataField Key=\"City\" DataFieldName=\"City\" Header-Text=\"City\" \/>\n            &lt;ig:BoundDataField Key=\"CompanyName\" DataFieldName=\"CompanyName\" Header-Text=\"Company\" \/>\n            &lt;ig:BoundDataField Key=\"ContactName\" DataFieldName=\"ContactName\" Header-Text=\"Contact\" \/>\n            &lt;ig:BoundDataField Key=\"Phone\" DataFieldName=\"Phone\" Header-Text=\"Phone\"\/>\n        &lt;\/Columns>\n        &lt;Behaviors>\n            &lt;ig:Activation ActiveCellCssClass=\"ActiveCellClass\" ActiveRowCssClass=\"ActiveRowClass\">\n            &lt;\/ig:Activation>\n            &lt;ig:Selection SelectedCellCssClass=\"SelectedCellClass\">\n            &lt;\/ig:Selection>\n        &lt;\/Behaviors>\n    &lt;\/ig:WebDataGrid>\n    &lt;asp:AccessDataSource ID=\"AccessDsCustomers\" runat=\"server\" DataFile=\"~\/App_Data\/Nwind.mdb\"\n        SelectCommand=\"SELECT [CustomerID], [CompanyName], [ContactName], [Address], [City], [Phone], [Country] FROM [Customers] ORDER BY [Country]\">\n    &lt;\/asp:AccessDataSource><\/pre>\n\n\n\n<p><strong>Notes:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The css classes with selectors are always taking priority and if the selectors are omitted in custom classes, the styling might look different from expected.<\/li>\n\n\n\n<li>A potential side effect from css selectors may be that these styles will be applied to ALL td elements in the body (not only the first level td elements as with the angle bracket notation), including those in cell templates, so working with the selectors needs to be done carefully.<\/li>\n\n\n\n<li>Internet Explorer 6 does not support selectors with angle bracket format (\u2018&gt;\u2019).&nbsp;&nbsp;For applications that target IE6 the angle bracket must be omitted. Example:<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tbody tr.NewRowCssClass td\n\n{\n    \/*styles*\/\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>WebDataGrid CSS Styling Guide provides guidelines for customizing the appearance of the WebDataGrid using CSS. It covers modifying colors, fonts, cell sizes, borders, backgrounds, and animations, as well as applying custom classes to enhance the user experience.<\/p>\n","protected":false},"author":31,"featured_media":2367,"comment_status":"publish","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-372","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to"],"_links":{"self":[{"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/posts\/372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/comments?post=372"}],"version-history":[{"count":3,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/posts\/372\/revisions"}],"predecessor-version":[{"id":2490,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/posts\/372\/revisions\/2490"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/media\/2367"}],"wp:attachment":[{"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/media?parent=372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/categories?post=372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infragistics.com\/blogs\/wp-json\/wp\/v2\/tags?post=372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}