开发者

ASP.NET ListView - Render THEAD/TBODY Tags

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

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

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?

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


It is cause you mark table as runat element

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

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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜