Many time in our application we want to merge the cell or row of GridView control for better user interface. The are many methods on internet to solve this problem but with long and complex code. Here I am giving a simple and easy to understand example of how we can merge cell ( Columns) of GridView Control in asp.net
In this example every row and cell of Gridview is being read, starting from the second last at the bottom, to the top row of GridView. If a cell value is matching with the value of the previous row (lower row) cell then the RowSpan is increased and making the lower cell invisible, and so on…
Following sqlserver table (tbdept) is used in the example
Here is code for .aspx page
Code for .cs file (Replace the Page_Load event with following code)
Other Related Posts
no fear choudhary is here,Wednesday, September 15, 2010
Site Checking