Click here to Skip to main content
15,896,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
1: First requirement
How can i freeze Header of gridview so when i scroll it vertically then the header remains constant and only data should move.

2: Second requirement
my first column in gridview is edit ie.

XML
<asp:ButtonField CommandName="Select" ItemStyle-ForeColor="Red" Text="Edit">
                               <ItemStyle ForeColor="Red" />
                           </asp:ButtonField>


so i also want to do freeze it so when user scroll it horizontally then it should remains intact.

any help should be highly appriciated..
Posted

 
Share this answer
 
Use this,


CSS :

CSS
.trfixedHeader
{
    position:relative;
    top:expression(this.parentNode.parentNode.parentNode.scrollTop-1);
}


and set header style for Gridview as

<HeaderStyle CssClass="trfixedHeader"  />
 
Share this answer
 
You can have a quick look into this
How to Freeze GridView Header While Scrolling ?[^]
If you are using AJAX Updatepanel, try out this
Maintain GridView Scroll Position and Header Inside Update Panel[^]
I did it long back and posted that as article in Code project,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900