Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to make grouping in a gridview based on a column in gridview.
Ex-

I have records like this in gridview:

ID Name Code Value
1 A a 1
2 A a 2
3 B b 3
4 B b 4


Result required(grouping based on code column):

ID Name Value
a
1 A 1
2 A 2
b
1 B 3
2 B 4

Please give solution for this.
Posted
Comments
Sandeep Mewara 26-Apr-12 14:40pm    
Tried anything?

For grouping in gridView you need to use Nested GridView which will solve your problem for sure, please refer some threads:

This article presents how the GridView control can be nested:
Multilevel Nested Master/Detail Data Display Using GridView[^]

Build a Nested GridView Control with ASP.NET[^]

The next article, will shows how you can override Render event to create group header based on your sorting column.
Creating a Customized Sorting User Interface (C#)[^]

You can use Edit permissions in Grid View[^]

GridViewHelper[^] as the name suggests, a helper class to aid the creation of groups and summaries.

Hope it helps!
 
Share this answer
 
Hi ,
You need Grid Expand another Grid See this Example it will help you
How to show Grid Within Grid[^]
Best Regards
M.Mitwalli
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900