Grid export error when groups are created in code behind

Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Mladen MarasMember

We are using WebUI Studio 2009 R2 with all fixes.

We have grid with 10 columns defined on the aspx page. First 2 columns have Visible="false".

In code-behind, in the WebGrid1_InitializeLayout event, 2 groups are created and their ColumnMember are those 2 hidden columns.

When I select Export on the grid, an alert is shown with text - Column "Column1" not found.

I tried to set those columns visible in the WebGrid1_Export :

protected void WebGrid1_Export(object sender, ISNet.WebUI.WebGrid.ExportEventArgs e)
        {
            e.Table.Columns.GetNamedItem("Column1").Visible = true;
        }

If I try to export, another alert is shown with text - Object reference not set to an instance of an object.

On the other hand, if groups are defined on the aspx page in the <GroupedColumns> section of the grid, everything works fine.

We have around 10+ different pages with grid. Each page has grid that generates groups based on UrlParameter and different UrlParameter values can be between 2 and 8 per page. That means that those 10+ pages wih dynamically generated groups replace between 40 and 60 statically defined aspx pages.

Is there a way to make export work with groups defined in code-behind?

All times are GMT -5. The time now is 11:44 AM.
Previous Next