Gridview两个标题行。 [英] Gridview two header rows.
本文介绍了Gridview两个标题行。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
girdview中两个标题行的问题。
problem with two header row in girdview.,
<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>
推荐答案
这不会起作用。您正试图在< th> 和< tr>
>另一个< th>
,这是无效的标记。
您可以编写自己的GridView
控件添加新的标题行:
http://blogs.msdn.com/b/mattdotson/archive/2006/03/01/real-world-gridview-two- heads-grouping-gridviews.aspx [ ^ ]
您可以尝试设置标题
属性 [ ^ ],并添加任何必要的样式,使其看起来像你想要的。
或者,如果所有其他方法都失败了,你可以切换到ListView
控制 [ ^ ],它可以更好地控制生成的标记。
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 ownGridView
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 theCaption
property[^], and add any necessary styling to make it look like what you want.
Or, if all else fails, you could switch to theListView
control[^], which gives you much better control over the generated markup.
这篇关于Gridview两个标题行。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文