How do I "row-wrap" ? i.e., have 2 rows of headers, and 2 rows in grid for each data record?

Hi

I have built a view in Sql Server, and built my Sql Data Source, and everything looks good... I have my data grid populating nicely.

But, I want the headers and rows to wrap - not inside each cell, but to fit the page.

Let's say I have 10 columns, and only 5 will fit in the width of a webpage.  I would want the headers to wrap, so there are two rows of headers, then each data record would fill 2 rows in the grid.

Example:

 <headers>

Last Name................First Name.............. Middle Name.............DOB............SSN............. <end of this row in grid>

Address Line 1...........Address Line 2...........City.................State............ZIP         <end of second header row>

<data>

Robert...................Johnson....................... Claudio.................. November 12, 1922 ................ 555-55-5555  

5500 Loopy Street.......... Suite 120............ . Las Vegas............. NV............. 66666  <end of first record, end of 2nd row of data>

 

Does this make sense?

What is this called, and how would I go about doing it?

Thanks

 

0
kblackwell
2/19/2007 9:34:14 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies
732 Views

Similar Articles

[PageSpeed] 58

I think what this is called is a kludge.  I doubt it's possible with a GridView, because a GridView essentially renders an html table, and what you actually want to do is to display data in alternate rows.  You can extract the data then render your own html to do this, but of course you lose the power of a GridView (or at least the simplicity they offer).

I suggest that what you need to do is rethink your approach, in that you say that only 5 columns will "will fit in the width of a webpage".  What you mean is that only 5 columns will fit the space you have designed for them.  See if a redesign will solve the problem.


Regards Mike
[MVP - ASP/ASP.NET]
My site
0
Mikesdotnetting
2/19/2007 10:38:15 PM

Actually, I've been searching and think I could probably accomplish this with a Repeater which builds a table, rather than a gridview.

I could have the header and footer build the <table /table> tags, and have the repeater put the data into two rows.  Yes, it'll be a lot more work that just making a gridview, but I believe that's what's specifically wanted here, so that'll have to do it.

But, of course, I'm open to any other suggestions!

Thanks!

 

0
kblackwell
2/19/2007 11:22:30 PM

Yep!  I got a repeater to do this so that it works exactly like I want.

BUT..... it would be nice to be able to click on one of the header items to sort.... any thoughts on that?  I'll search on that tomorrow.

Stick out tongue

0
kblackwell
2/20/2007 12:14:33 AM
Reply: