• Home
  • About
  • Resume

Infragistics WebDataGrid: Hidden columns become visible after AJAX postback

By , 12/12/2012 11:30 AM

A recent update to .NetAdvantage for ASP.NET v12.2 introduced a weird bug – hidden columns of WebDataGrid and WHDG become visible after postback. Service release 12.2.20122.2031 fixed that issue – but only for full postback. Under some circumstances if grid performs an AJAX call (sorting, paging etc.) hidden columns become visible again. This does not happen in IE, but other browsers, such as Chrome and FireFox do exhibit the issue.

This is happening because hidden columns lose “display:none” property in their style. If this happens to you – you have to take matter in your own hands.

First create a simple CSS class to hide columns:

.hiddenElement {
	display:none;
}

Then you need to loop thru all the columns in your grid, adding following code for each column.

If you set the “hidden” property programmaticaly in server-side code:

'... looping thru columns, and for each column perform:
oColumn.Hidden = True
oColumn.CssClass = "hiddenElement"
oColumn.Header.CssClass = "hiddenElement"

If “hidden” property is set in ASP markup:

'... looping thru columns, and for each column perform:
if oColumn.Hidden
   oColumn.CssClass = "hiddenElement"
   oColumn.Header.CssClass = "hiddenElement"
End If

Essentially what this does is forces “display:none” for hidden columns so they remain hidden. This loop can be added to grid Init or PreRender event.

3 Responses to “Infragistics WebDataGrid: Hidden columns become visible after AJAX postback”

  1. Tom says:

    Thank you for posting this work around. I hate these little bugs and quirks in Infragistics. They cause great frustration!!

  2. Jacob says:

    I’ve been fighting with this for a couple days now, this was EXACTLY the solution I needed. Thank you so much for contributing!

  3. Eric Anderson says:

    Started seeing this on version 13.2.20132.2187 and this fixed 95% of the issue. Needed to add the following to the loop which “rehid” the columns:

    oColumn.Width = Unit.Pixel(0)

    Thanks Infragistics.

Leave a Reply

Panorama Theme by Themocracy