如何在ASP.NET中创建表THEAD和TBODY? [英] How to create thead and tbody in ASP.NET Table?
问题描述
如何创建THEAD和TBODY在ASP.NET表?我需要因为jQuery的那些标签和asp.net给我只有TR,th和td。
<罢工>的 ASP:表不支持这些元素击>
更新: jameh的回答显示,上面这句话是完全错误的:在
TableSection
属性允许控制
一个给定的行是否进入表的标题,正文或页脚。
块引用>要详细说明他的回答,看来你甚至可以声明通过设置您的标记中的
TableSection
属性做到这一点,没有落后code:&LT; ASP:表ID =yourId=服务器&GT;
&LT; ASP:TableHeaderRow TableSection =tableHeader为&GT;
&LT;! - ... - &GT;
&LT; / ASP:TableHeaderRow&GT;
&LT; ASP:&的TableRow GT;
&LT;! - 'TableSection'默认为'TableRowSection.TableBody。 - &GT;
&LT;! - ... - &GT;
&LT; / ASP:&的TableRow GT;
&LT; ASP:的TableRow TableSection =TableFooter&GT;
&LT;! - ... - &GT;
&LT; / ASP:&的TableRow GT;
&LT; / ASP:表&gt;
的原来,现在没有实际意义的回答如下:的
块引用>您可能想尝试的<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmltable%28v=VS.100%29.aspx\">HtmlTable类,而不是:
&LT;表ID =yourId=服务器&GT;
&LT;&THEAD GT;
。
。
。
&LT; / THEAD&GT;
&LT;&TBODY GT;
。
。
。
&LT; / TBODY&GT;
&LT; /表&gt;How to create thead and tbody in ASP.NET Table ? I need those tags because of jquery and asp.net gives me only tr, th and td.
解决方案
asp:Table does not support these elements.Update: As jameh's answer reveals, the sentence above is completely wrong: the
TableSection
property allows to control whether a given row goes into the table's header, body or footer.To elaborate on his answer, it seems you can even achieve this declaratively by setting the
TableSection
property in your markup, without code behind:<asp:Table id="yourId" runat="server"> <asp:TableHeaderRow TableSection="TableHeader"> <!-- ... --> </asp:TableHeaderRow> <asp:TableRow> <!-- 'TableSection' defaults to 'TableRowSection.TableBody'. --> <!-- ... --> </asp:TableRow> <asp:TableRow TableSection="TableFooter"> <!-- ... --> </asp:TableRow> </asp:Table>
Original, now moot answer follows:
You might want to try the HtmlTable class instead:
<table id="yourId" runat="server"> <thead> . . . </thead> <tbody> . . . </tbody> </table>
这篇关于如何在ASP.NET中创建表THEAD和TBODY?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!