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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fixed Header in asp.net datagrid

Status
Not open for further replies.
In the past, I have just creatd a div or table with one row and the cols in it. Then below that, the actual datagrid with no headers in a scrollable div.
 
Or you could go with a javascript based solution. I actually prefer that method as I see a fixed header as an enhancement rather than core functionality.

Mark,

[URL unfurl="true"]http://lessthandot.com[/url] - Experts, Information, Ideas & Knowledge
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Website Design
[URL unfurl="true"]http://aspnetlibrary.com[/url] - An online resource for professional ASP.NET developers
 
Mark,

Do you have a link to an example? All the ones I have found are either like the link I posted or involve creating a seperate table as jbenson001 suggested.

Thanks,
Jeremy
 
I don't think this solution will work with 2003 will it? I tried adding the code to my datagrid and it doesn't recognize this code:

Private Sub dgPreOp_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgPreOp.PreRender
ScrollT.UseAccessibleHeader = True
ScrollT.HeaderRow.TableSection = TableRowSection.TableHeader
End Sub

Or is it because they are using a Gridview and not a Datagrid?

Thanks,
Jeremy
 
Or is it because they are using a Gridview and not a Datagrid?
Yes, those controls are different so you may have to modify the code. It's exactly the same principle though and you just need to have a look at what is happening client side to understand what you need to do.

Mark,

[URL unfurl="true"]http://lessthandot.com[/url] - Experts, Information, Ideas & Knowledge
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Website Design
[URL unfurl="true"]http://aspnetlibrary.com[/url] - An online resource for professional ASP.NET developers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top