actually there is no direct way for implementing fixed footer. So, here you have to play with gridview and panel.
I have implement in my side now its working fine. and looking good.
just study below link, and get this logic. I have already implement in my side as a test project.
First you make it test project.
JavaScript
<script language="javascript" type="text/javascript">
function MakeStaticHeader(gridId, height, width, headerHeight, isFooter) {
var tbl = document.getElementById(gridId);
if (tbl) {
var DivHR = document.getElementById('DivHeaderRow');
var DivMC = document.getElementById('DivMainContent');
var DivFR = document.getElementById('DivFooterRow');
DivHR.style.height = headerHeight + 'px';
DivHR.style.width = (parseInt(width) - 16) + 'px';
DivHR.style.position = 'relative';
DivHR.style.top = '0px';
DivHR.style.zIndex = '10';
DivHR.style.verticalAlign = 'top';
DivMC.style.width = width + 'px';
DivMC.style.height = height + 'px';
DivMC.style.position = 'relative';
DivMC.style.top = -headerHeight + 'px';
DivMC.style.zIndex = '1';
DivFR.style.width = (parseInt(width) - 16) + 'px';
DivFR.style.position = 'relative';
DivFR.style.top = -headerHeight + 'px';
DivFR.style.verticalAlign = 'top';
DivFR.style.paddingtop = '2px';
if (isFooter) {
var tblfr = tbl.cloneNode(true);
tblfr.removeChild(tblfr.getElementsByTagName('tbody')[0]);
var tblBody = document.createElement('tbody');
tblfr.style.width = '100%';
tblfr.cellSpacing = "0";
tblfr.border = "0px";
tblfr.rules = "none";
tblBody.appendChild(tbl.rows[tbl.rows.length - 1]);
tblfr.appendChild(tblBody);
DivFR.appendChild(tblfr);
}
DivHR.appendChild(tbl.cloneNode(true));
}
}
</script>
.aspx
<div id="DivRoot" align="left">
<div style="overflow: hidden;" id="DivHeaderRow">
</div>
<div style="overflow:scroll;" onscroll="OnScrollDiv(this)" id="DivMainContent">
<asp:GridView runat="server" ShowFooter="true" scrollbar ID="gvdetails" AutoGenerateColumns="false">
<RowStyle BackColor="#EFF3FB" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle CssClass="GVFixedHeader" />
<FooterStyle CssClass="GVFixedFooter" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="UserId" HeaderText="UserId" FooterText="Footer" />
<asp:BoundField DataField="UserName" HeaderText="UserName" FooterText="Footer" />
</Columns>
</asp:GridView>
</div>
<div id="DivFooterRow" style="overflow:hidden">
</div>
Load Event:
DataTable dt = new DataTable("tst");
dt.Columns.Add("UserID");
dt.Columns.Add("UserName");
DataRow dr;
for(int i=0;i<100;i++)
{
dr = dt.NewRow();
dr["UserID"] = "123" + i.ToString();
dr["UserName"] = "Test" + i.ToString();
dt.Rows.Add(dr);
}
gvdetails.DataSource = dt;
gvdetails.DataBind();
ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key", "<script>MakeStaticHeader('" + gvdetails.ClientID + "', 400, 950 , 40 ,true); </script>", false);
Reference Url :
http://www.dotnetbull.com/2011/11/scrollable-gridview-with-fixed-headers.html[
^]