views:

97

answers:

1

I am using an ASP.NET ListView control and, at the moment, I have a scrollable grid:

(example below is simplified and contains embedded styling for sake of question)

<asp:ListView ID="ListView" runat="server" DataKeyNames="Id">
        <LayoutTemplate>
            <div style="height:225px; overflow:auto;">
                <table runat="server">
                    <tr>
                        <th>
                            <span>Column1</span>
                        </th>
                        <th>
                            <span>Column2</span>
                        </th>
                        <th>
                            <span>Column3</span>
                        </th>
                    </tr>
                    <tr id="itemPlaceholder" runat="server" />
                </table>
            </div>
        </LayoutTemplate>
        <ItemTemplate>
            <tr id="items" runat="server">
                <td class="first">
                    <%#Eval("Column1")%>
                </td>
                <td>
                    <%#Eval("Column2")%>
                </td>
                <td>
                    <%#Eval("Column3")%>
                </td>
            </tr>
        </ItemTemplate>
    </asp:ListView>

I'd like to apply CSS such that my headers are fixed.

What styling can I add to make it work?

+1  A: 

Try http://www.imaputz.com/cssStuff/bigFourVersion.html ?

Riley
I think this is a really clean solution, but unfortunately, the ListView control ignores the THEAD and TBODY tags.I didn't think of this when posting the question.
Jeremiah
Does this example provide any assistance: http://www.codeproject.com/KB/webforms/CompleteListView.aspx ?
Riley
I'm sorry, I stand corrected:http://stackoverflow.com/questions/2877898/asp-net-listview-render-thead-tbody-tagsThis works.
Jeremiah