views:

102

answers:

2

Hi my dear lords :

How Can We Have A SCROLLABLE GridView With Fixed Header???(in vs 2008 - asp.net with c#)

Fixed Header is my problem!

i test many ways for doing that and see some live demos / but they did not work.

can u show me a simple way 4 doing that with an example?

thanks in future advance

A: 

This blog post might help you:

http://www.dotnetcurry.com/ShowArticle.aspx?ID=255&AspxAutoDetectCookieSupport=1

He has found a way to create fixed gridview headers and footers using a bit of jQuery. I haven't tried this myself, but judging by the comments, it works for many people.

adrianos
hi my dear friend / i saw your link / but i could not find scroll bar in it's project...!
LostLord
A: 

two tables, one for header and one for content. only problem is that u need to set specific widths for each column.

<style>
    .tbl th { border: 1px solid black; background:#DDD; }
    .tbl td { border: 1px solid black; border-top:none }
    .scroll { height:80px; overflow-y:auto }
</style>

<table class="tbl">
    <colgroup>
        <col style="width:100px" />
        <col style="width:150px" />
    </colgroup>
    <tr>
        <th>header1</th>
        <th>header2</th>
    </tr>
 </table>

<div class="scroll">
    <table class="tbl">
        <colgroup>
            <!-- same as before -->
            <col style="width:100px" />
            <col style="width:150px" />
        </colgroup>
        <tr><td>....</td><td>...</td></tr>
        <tr><td>....</td><td>...</td></tr>
        <tr><td>....</td><td>...</td></tr>
        <tr><td>....</td><td>...</td></tr>
        <tr><td>....</td><td>...</td></tr>
        <tr><td>....</td><td>...</td></tr>
        <tr><td>....</td><td>...</td></tr>
        <tr><td>....</td><td>...</td></tr>
        <tr><td>....</td><td>...</td></tr>
    </table>
<div>
​
y34h