Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have a table with lots of fields.
To display every record that has lots of columns on a web browser will inconveniently force the users to drag the scrollbar to the right.

Is it possible to divide each record to two or three inner rows in gridview?

e.g.
My table has these fields:
- UPC
- Description
- AdType_Week1
- AdType_Week2
- AdType_Week3
- AdType_Week4
- AdType_Week5
- Price_Week1
- Price_Week2
- Price_Week3
- Price_Week4
- Price_Week5
- OrderStatus_Week1
- OrderStatus_Week2
- OrderStatus_Week3
- OrderStatus_Week4
- OrderStatus_Week5

Instead of showing everything in one header like this:
UPC | Description | AdType_Week1 | AdType_Week2 | AdType_Week3 | AdType_Week4 | AdType_Week5 | Price_Week1 | Price_Week2 | Price_Week3 | Price_Week4 | Price_Week5 | OrderStatus_Week1 | OrderStatus_Week2 | OrderStatus_Week3 | OrderStatus_Week4 | OrderStatus_Week5


I would like to show it like this:
|-UPC-|-Description-|-AdType_Week1------|-AdType_Week2------|-AdType_Week3------|
___01_____banana________type abc____________type def____________type feg
____________________|-Price_Week1-------|-Price_Week2-------|-Price_Week3-------|
________________________$97.51______________$78.48______________$41.45
____________________|-OrderStatus_Week1-|-OrderStatus_Week2-|-OrderStatus_Week3-|
________________________arrived_____________in-progress_________in-progress


|-UPC-|-Description-|-AdType_Week1------|-AdType_Week2------|-AdType_Week3------|
___02_____apple_________type abc____________type def____________type feg
____________________|-Price_Week1-------|-Price_Week2-------|-Price_Week3-------|
________________________$97.51______________$78.48______________$41.45
____________________|-OrderStatus_Week1-|-OrderStatus_Week2-|-OrderStatus_Week3-|
________________________arrived_____________in-progress_________in-progress


|-UPC-|-Description-|-AdType_Week1------|-AdType_Week2------|-AdType_Week3------|
___03_____orange________type abc____________type def____________type feg
____________________|-Price_Week1-------|-Price_Week2-------|-Price_Week3-------|
________________________$97.51______________$78.48______________$41.45
____________________|-OrderStatus_Week1-|-OrderStatus_Week2-|-OrderStatus_Week3-|
________________________arrived_____________in-progress_________in-progress
Posted
Updated 20-Sep-14 12:20pm
v3
Comments
Herman<T>.Instance 23-Sep-14 7:44am    
do it by hand by wrapping your table to a new definition

1 solution

Hate to plug for a tool, but have to do it here.

I wouldn't create something like this from scratch if I could spend a few hundred bucks on 3rd party controls.

See this for some inspiration:
https://demos.devexpress.com/ASPxGridViewDemos/Templates/CardView.aspx[^]

I'm sure it can be done with the built in grid view - but it may take extending the default .NET grid view control significantly to make it all work right. A clever 3rd party control like I've shown a demo for above would make this into a trivial matter...and look way better than the .NET default grid.

If spending $ is not realistic, perhaps you can do something else with the grid view or use a different control (since you are essentially creating something like a "card view"). Something like the list view control allows for full template customization - so you can make things look however you like.
 
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