如何在 ASP.NET 表中创建 thead 和 tbody? [英] How to create thead and tbody in ASP.NET Table ?

查看:26
本文介绍了如何在 ASP.NET 表中创建 thead 和 tbody?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 ASP.NET Table 中创建 thead 和 tbody?我需要这些标签,因为 jquery 和 asp.net 只给我 tr、th 和 td.

解决方案

asp:Table 不支持这些元素.

<块引用>

更新:正如 jameh 的回答所揭示的那样,上面的句子是完全错误的:TableSection 属性允许控制给定的行是否进入表格的页眉、正文或页脚.

为了详细说明他的回答,您似乎甚至可以通过在标记中设置 TableSection 属性来声明性地实现这一点,而无需隐藏代码:

<asp:TableHeaderRow TableSection="TableHeader"><!-- ... --></asp:TableHeaderRow><asp:TableRow><!-- 'TableSection' 默认为 'TableRowSection.TableBody'.--><!-- ... --></asp:TableRow><asp:TableRow TableSection="TableFooter"><!-- ... --></asp:TableRow></asp:Table>

<小时><块引用>

原来的,现在没有实际意义的答案如下:

您可能想尝试 HtmlTable 类:

<头>...</thead>...</tbody>

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆