Gridview Freeze Pane Header Not Freezing After Page Loads
Browser - IE 9 Using the Latest Version of Microsoft's AdventureWorks2012 sandbox database (AdventureWorks2012_Data.zip) for SQL related Data. I had to put this project on the back
Solution 1:
You are almost there. You should name the javascript function Onscrollfnction()
.
EDIT:
- You replace the HeaderDiv content with tr html.
- You have to apply style to HeaderDiv.
Here's the script:
</style><scriptsrc="//code.jquery.com/jquery-1.10.2.js"></script><scripttype="text/javascript">functionOnscrollfnction() {
var header = $("#GridView1").find('tr:first').html();
$("#HeaderDiv").html(header);
$("#HeaderDiv").addClass("GridViewHeaderStyle");
}
</script>
Further improvements:
I would apply fixed width to GridView Columns and apply the widths to headers in the HeaderDiv column headers.
I would hide the GridView's header and display the HeaderDiv instead, to avoid the annoying transition in the beginning of scrolling.
Solution 2:
I got frustruated with trying to find a javascript solution so I found one that is CSS based and works perfectly. For anyone who needs it moving forward, here's the article I referenced.
Post a Comment for "Gridview Freeze Pane Header Not Freezing After Page Loads"