ASP.NET ListView控件 - 渲染THEAD / TBODY标签 [英] ASP.NET ListView - Render THEAD/TBODY Tags

查看:204
本文介绍了ASP.NET ListView控件 - 渲染THEAD / TBODY标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET ListView控件(见下文)。

I have an ASP.NET ListView control (see below).

不幸的是,当一个ListView控件是渲染是这样做不存在的HTML标签,如THEAD / TBODY。

Unfortunately, when a ListView control is rendered is does so absent of HTML tags such as THEAD/TBODY.

这是对我造成一个问题,因为我使用的CSS样式需要这些标签。

This is causing a problem for me because the CSS styling that I'm using needs those tags.

<asp:ListView ID="ListView" runat="server" DataKeyNames="Id">
        <LayoutTemplate>
            <div id="tableContainer" class="tableContainer">
                <table runat="server" class="scrollTable" >
                  <thead class="fixedHeader">
                    <tr>
                        <th>
                            <span>Column1</span>
                        </th>                           
                    </tr>
                   </thead>
                   <tbody class="scrollContent">
                    <tr id="itemPlaceholder" runat="server" />
                   </tbody>
                </table>
            </div>
        </LayoutTemplate>
        <ItemTemplate>
            <tr id="items" runat="server">
                <td class="first">
                    <%#Eval("Column1")%>
                </td>                    
            </tr>
        </ItemTemplate>
    </asp:ListView>

什么办法可以让这些标签来呈现?

Any way I can get those tags to render?

我在找一个干净的解决方案,我打开使用jQuery prePEND /附加(如果可能)获得成功。

I'm looking for a clean solution and I am open to using jQuery Prepend/Append (if possible) to achieve success.

推荐答案

这是因为你标记表作为RUNAT元素

It is cause you mark table as runat element

<table runat="server" class="scrollTable" >

可能是ASP.NET窗体框架的实现会导致表内容的分析与删除THEAD的标签。

May be ASP.NET Forms framework realization causes a parsing of table content with removing "thead" tags.

努力实现布局无标记带=服务器表标签。我试了一下,THEAD标签(tag)。

Try to realize your layout without marking table tag with runat="server". I tried it and thead tag is rendered.

这篇关于ASP.NET ListView控件 - 渲染THEAD / TBODY标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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