Requirements |
|
RadControls version |
2009_2_1028 |
.NET version |
3.5 |
Visual Studio version |
2008 |
programming language |
VB |
browser support |
all browsers supported by RadControls |
PROJECT DESCRIPTION
Several persons, including me, were asking in the forum how to export multiple grids displayed in the view to a single Excel worksheet. Daniel presented a trivial example that was not practical, but it did serve as the foundation of the code I developed the following day. My requirement was to aggregate all the data displayed in a webform and export it to Excel. The data consists of 4 HTML tables dynamically populated by ASP labels in the code-behind, and 4 different RadGrids, each one displaying a dataset from a different database table having different schemas. To accomplish this, I stuck a skeleton radGrid tag on the webform and wrote 2 essential methods in the code-behind (2 others are just the Excel formatting methods). I have attached list_LIN_detail.aspx (see the radgrid tag at the bottom under the export button) and list_LIN_detail.aspx.vb (see the methods towards the end of the code obviously commented for this subject). The Excel column headers are the radGrid's unique names.
One caveat: there is a bug that throws an IllegalOperationException when ASP label text is nothing and it needs to be cast to an integer. No big deal.