开发者

Elegant ways of displaying a GridView with lots of columns (ASP.NET)

开发者 https://www.devze.com 2023-02-04 14:09 出处:网络
just a general design question that I\'d like to hear some of your opinions on. I am designing a system for a client, and I\'m using GridView\' a lot. They need a lot of columns to be displayed 开发者

just a general design question that I'd like to hear some of your opinions on. I am designing a system for a client, and I'm using GridView' a lot. They need a lot of columns to be displayed 开发者_如何学Pythonin some of these, and I've had to resort to using a panel with a horizontal scrollbar. This presents some issues - keeping track of which row is which is difficult, even with alternating row colours, and it's generally pretty ugly.

How have you dealt with these issues before? Are there any sort of AJAX controls that could help, so some data could be only displayed on hover or such? Or any other general ideas.


Matt Berseth has great tutorials about optimizing the gridviews:

http://mattberseth.com/blog/2007/08/creating_a_gridview_with_resiz.html

http://mattberseth.com/blog/2007/10/improving_the_presentation_of.html

Hope these links help!


I have a solution to this, although I was surfing here to see if there are any better alternatives. I don't think MB addresses the specific issue, which is how you display a lot of columns without resorting to horizontal scrolling.

I have GridViews with 150 or so columns, and up to about 10,000 rows. I page them so the row count isn't a huge issue (export them to Excel if you want to play with 10,000 at once). But the columns are an issue... here's what I've been using for the last couple of years:

  1. I group the columns by adding classes to the header and items for each column, assigning each column to a section (for example: procedure/ diagnosis/ financial).
  2. Then I have a set of radio buttons which have values which are the names of those classes, so you can use the (jQueryUI themed) radio buttons to pick which section of the horizontal grid you want to view.
  3. Click the radio buttons, and jQuery hides what was on display, and shows the columns with the class you just selected.

This works fine, in that the "horizontal paging" is entirely client side and quick even with IE6 (have to write the jQuery quite carefully for that). I have some pages where I generate the "horizontal pages" based on what's in the table; for the standard stuff I hand-craft the pages and classes.

Anyone got any better ideas?

0

精彩评论

暂无评论...
验证码 换一张
取 消