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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extra column headers on top of grid

Status
Not open for further replies.

sajidi99

Programmer
Jun 7, 2005
53
SE
Hi,

I need to show extra column headers in the datagrid. Can someone help me ... how to do that?

Datagrid should be something like this:-

Original New
-------- ---
Week Date Week Date
: : : :
: : : :
: : : :

My question is how to display "Original" & "New" headings that span over 2 columns?

Thanks


 
well you could hack it and not make it part of the datagrid, but a table directly above it.

or, make original and new the headers in your datagrid then add a row at position 0 of the grid with your subheaders.
 
You can achieve this using what I think is termed 'CSS'. I presume you're using an asp web page to output the content of your datagrid?

As tperri says, use two tables, one to display your headers, the second to display your datagrid, and then just line up the headers in the first table. I'm no expert but it's simple enough to get working.

Example:

<table style="margin-left: auto; margin-right: auto">
<tr>
<td style="text-align: center;">
<asp:Label ID="lblLabel" runat="server" Text="Header" />
</td>
<td style="width: 50px;"></td>
<td>
<asp:Label ID="Label1" runat="server" Text="Header2" />
</td>
</tr>
</table>
<table style="margin-left: auto; margin-right: auto">
<tr>
<td>
<asp:DataGrid ID="dgQuery" runat="server" />
</td>
</tr>
</table>
 
Hi all

thanks for replying but i am using C# windows application
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top