Chicharito
Chicharito

Reputation: 1440

How to make Asp.net Gridview header and first column frezee?

how to make html table header and first column frezee, my code is not work all web browser.

Link: http://jsfiddle.net/avFBx/

How to make ?

css code:

.tbl th
        {
            background-color: Aqua;
            position: relative;
        }        
        .locked
        {
            background-color: Red;
            position: relative;
        }
        #divgrid
        {
            height: 150px;
            width: 350px;
            overflow: auto;
        }

html code:

<div id="divgrid">
        <table class="tbl">
            <tr>
                <th class="locked">
                    a
                </th>
                <th>
                    b
                </th>
                <th>
                    c
                </th>
                <th>
                    d
                </th>
                <th>
                    e
                </th>
            </tr>
            <tr>
                <td class="locked">
                    aaaaaaaaaaaaaaaa
                </td>
                <td>
                    aaaaaaaaaaaaaaaa
                </td>
                <td>
                    aaaaaaaaaaaaaaaa
                </td>
                <td>
                    aaaaaaaaaaaaaaaa
                </td>
                <td>
                    aaaaaaaaaaaaaaaa
                </td>
            </tr>
</table>
</div>

Upvotes: 1

Views: 1071

Answers (2)

NakedBrunch
NakedBrunch

Reputation: 49413

Check this demo out: FixedHeaderTable.com

It is entirely jQuery and does exactly what you're looking for.

Upvotes: 1

Gerardo Jaramillo
Gerardo Jaramillo

Reputation: 485

I will try to put a div with another table of the same size inside the header table, and with css put the overflow scroll... but you have to be very carefull with your mesurments so they match... the headers witdth with the columns width...

Its tricky but I think it can work.

Upvotes: 0

Related Questions