Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fixed column headings on a datagrid in an aspx page

Status
Not open for further replies.

scotitpulsa

IS-IT--Management
Oct 1, 2003
61
US
I've found a really cool way to have the column headings of a datagrid to be offset from the grid in a way to simulate fixing the column headings in an excel spreadsheet.

The problem I'm having is if the grid is not the first object on the page, say for instance there is a chart on the page above the grid, when you scroll down, the grid headings scroll immediately, not as the headings reach the top of the page. Consequently, if the datagrid is no visible on the initial load, say it is two scrolls down the page, as the user scrolls down the page, the column headings that are offset don't even show up because they are scrolling down as the user scrolls down. Here is the css sheet code...

.DataGridFixedHeader {position:relative; top:expression(this.offsetParent.scrollTop);}


Is there a way to have the headings stay put until the top of the grid gets to the top of the page, then start following the grid farther down as the user scrolls?
 
Can you show us a cut down test harness of your client-side code?

Also note, that your current solution is IE-only, and so will not work in any other browser.

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi
I would really like to use this code to fix the headers on a data grid (Datagrid1) but I am very new to html and CSS so I am unsure of what to so with it, where to paste it etc...

Hope you can help

Thanks a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top