Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
problem with two header row in girdview.,


ASP
<asp:GridView ID="grdPurchaseMaster" runat="server" Font-Bold="True"
                    CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False"
                   OnRowCommand="grdPurchaseMaster_RowCommand" Width="919px">
                   <AlternatingRowStyle BackColor="White" />
                   <Columns>
                       <asp:TemplateField>
                            <HeaderTemplate>
                             <th colspan="20">Purchase Order</th>
                             <tr>
                                <th></th>
                              </tr>
                         </HeaderTemplate>
                       </asp:TemplateField>
                       <asp:TemplateField HeaderText="GR No " Visible="False">
                          <ItemTemplate>
                               <asp:Label ID="lblGRNMain" runat="server" Text='<%#Eval("GRNMain") %>'></asp:Label>
                           </ItemTemplate>
                       </asp:TemplateField>
Posted
Comments
Kriti Sharma 10400841 4-Jul-14 6:16am    
i can not understand your problem.. please tell in brief..
CHill60 4-Jul-14 7:24am    
What is the problem exactly?

1 solution

That's not going to work. You're trying to put a <th> and a <tr> inside another <th>, which is invalid markup.

You could write your own GridView control to add a new header row:
http://blogs.msdn.com/b/mattdotson/archive/2006/03/01/real-world-gridview-two-headed-grouping-gridviews.aspx[^]

You could try setting the Caption property[^], and add any necessary styling to make it look like what you want.

Or, if all else fails, you could switch to the ListView control[^], which gives you much better control over the generated markup.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900