Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid (or GridView) layout - is this possible? 1

Status
Not open for further replies.

rjoubert

Programmer
Oct 2, 2003
1,843
US
Working in Visual Studio 2010

I have a asp:DataGrid that has 5 data-bound columns. The last of these columns contains data from a comment field, so there is potentially a lot of text to be displayed there. I was wondering if I could have the first 4 columns display on the first line, each taking up 25% of the datagrid, and the 5th column display below the other 4, taking up 100% of the width. I am not opposed to switching to a GridView, if that would help. Thanks in advance...
 
A datagrid vs a gridview is not going to matter in this case. If you don't need to edit the data, then I would switch to a repeater. With a repeater you have much greater control over the HTML that is output, which will be helpful in your case.

In instances where I needed to use gridviews, I made the "comment's column a fixed width and displayed a subset of the data, say (250 chars) with a "more ..." link. Then I had the full text display when the user hovered over the "more ..." link. This way you can still keep the grid output. You can also have the full text display in a popup if they click the link. It's up to you, but there are many ways to deal with your situation.
 
The repeater was exactly what I needed. Thanks for pointing me in the right direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top