Product A - Type A
Product B - Type A
Product C - Type B
Product D -Type B
Product E - Type C
Product F - Type D
My first move was to take a look at the DAL (Data access layer) to see how the objects are related, in order for me to plan on grouping it. They are returned as generic dataset, so i had to create some simple POCO (Plain Old C# Objects), i prefer to work with strongly-typed grids :)
After retrieving the the data, i've modified the DAL to return an IList of the POCO instead of DS.
With the data retrieval and formatting done, all i have to do now is to bind it to a gridview and set the group by option. A little googling, i found a custom gridview which allow grouping:
ZNetControls
Read a little on the page and from the author's documentation, it seem simple enough.
Read a little on the page and from the author's documentation, it seem simple enough.
- I created an ObjectDataSource that hooks up with the DAL GetAllBindableObjects() as the selectmethod.
- Added the library (ZNetControls) into my VS and added the ZNetGridview into the page
- Added the grouping type: DataKeyNames="Category"
Ran the page and i get this:
Pretty easy to implement :)
Group data rows to GridView in .NET
ReplyDelete