Creating a custom header and subheader for Aspx Grid View

This is a quick tip with code snippet on how to create an aspx gridview with a header and subheader. I did this one for my project and wanted to share my solution so that it can be of use to others.

A screenshot of the grid is given below.

Sample of the grid view with Subheader
Sample of the gridview with Subheader

Using the code

My solution was to create a new header row in the gridview and add cells to the row and change the column span property of the table header cell as required. This manipulation is done in the gridview’s row created event.

The code snippet for this is given below. The code snippet is in vb.net

Please leave comments if you have better solution.

Happy Coding! 🙂

Site Footer