Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

How to make a datagrid column a row

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken B - 25 Sep 2007 05:47 GMT
How can I make a datagrid column into a single row that spans all the
other columns?
In this case I have a comment field that I want to make as wide as the
table but I cannot figure out how to tell asp.net datagrid that I want
a new row.

I am using visual studio 2005,

Thanks to anybody who has tried this and has a solution

KB
Eliyahu Goldin - 25 Sep 2007 10:18 GMT
You may look at using a repeater with 2 rows in the itemtemplate. Something
like this:

<asp:repeater>
<headertemplate>
<table>
</headertemplate>
<itemtemplate>
<tr runat="server" id="trNormal">
<td>Databind expression for column 1</td>
<td>Databind expression for column 2</td>
<td>Databind expression for column 3</td>
</tr>
<tr runat="server" id="trComment">
<td columnspan=3>Databind expression for comment</td>
</tr>
</itemtemplate>
</asp:repeater>
<footertemplate>
</table>
</footertemplate>

and handle ItemDataBound event to hide trNormal or trComment as needed.
Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

> How can I make a datagrid column into a single row that spans all the
> other columns?
[quoted text clipped - 7 lines]
>
> KB
Michael Nemtsev, MVP - 25 Sep 2007 12:15 GMT
Hello Ken,

U need to handle RowDataBound event making changes to your rows there

see sample there http://dotnetjunkies.com/WebLog/joshuagough/archive/2006/06/23/141038.aspx

---
WBR,
Michael  Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour 

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

KB> How can I make a datagrid column into a single row that spans all
KB> the
KB> other columns?
KB> In this case I have a comment field that I want to make as wide as
KB> the
KB> table but I cannot figure out how to tell asp.net datagrid that I
KB> want
KB> a new row.
KB> I am using visual studio 2005,
KB>
KB> Thanks to anybody who has tried this and has a solution
KB>
KB> KB
KB>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.