In DataGrid both Header and Footer fixed while scrolling

Aug 16 2017 9:31 AM
Header and Footer in asp:DataGrid should be fixed while scrolling the data in Grid.
 
My Code:
 
<td align="center">
<table cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
<tr>
<td align="center">
<br>
<asp:Panel ID="PanelAsnArrival" runat="server">
<div id="divASNArrival" style="overflow: auto; width: 100%; height: 205px">
<asp:DataGrid ID="dg_ASN_Arrival" runat="server" Width="98%" AutoGenerateColumns="False" AllowPaging="true" PageSize="150"
CellPadding="4" BorderWidth="1px" BorderStyle="Solid">
<Columns>
<asp:BoundColumn HeaderText="Sl #" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="ASN #" HeaderStyle-Horizontal ItemStyle-Horizontal>
<ItemTemplate>
<font class="bodyText">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"AsnNo")) %>
</font>
<asp:TextBox ID="txtASNNO" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"AsnNo")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Line #" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<font class="bodyText">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"AsnLineNo")) %>
</font>
<asp:TextBox ID="txtASNLineNo" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"AsnLineNo")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Receipt #" HeaderStyle-Horizontal ItemStyle-Horizontal
Visible="false">
<ItemTemplate>
<font class="bodyText">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"ReceiptNo")) %>
</font>
<asp:TextBox ID="txtReceiptNo" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"ReceiptNo")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="SKU" HeaderStyle-Horizontal ItemStyle-Horizontal>
<ItemTemplate>
<font class="bodyText">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"Sku")) %>
</font>
<asp:TextBox ID="txtASNEbizSkuNo" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"EbizSkuNo")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="LOT/Batch#" HeaderStyle-Horizontal ItemStyle-Horizontal>
<ItemTemplate>
<font class="bodyText">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"BatchNo")) %>
</font>
<asp:TextBox ID="txtASNBatchNo" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"BatchNo")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Status" HeaderStyle-Horizontal ItemStyle-Horizontal>
<ItemTemplate>
<font class="bodyText">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"SkuStatusId")) %>
</font>
<asp:TextBox ID="txtASNSkuStatus" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"SkuStatusId")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="LP" HeaderStyle-Horizontal ItemStyle-Horizontal>
<ItemTemplate>
<font class="bodyText">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"LpNo")) %>
</font>
<asp:TextBox ID="txtASNLp" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"LpNo")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Ord Qty" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<font class="bodyText">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"QtyOrd")) %>
</font>
<asp:TextBox ID="txtOrdQty" runat="server" Visible="false" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"QtyOrd")) %>'>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Exp Qty" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<font class="bodyText">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"QtyOrd")) %>
</font>
<asp:TextBox ID="txtExpQty" runat="server" Visible="false" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"QtyOrd")) %>'>
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="UOM" HeaderStyle-Horizontal ItemStyle-Horizontal>
<ItemTemplate>
<font class="bodyText">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"UomId")) %>
</font>
<asp:TextBox ID="txtASNUomId" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"UomId")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="BOL" HeaderStyle-Horizontal ItemStyle-Horizontal>
<ItemTemplate>
<font class="bodyText">
<asp:TextBox ID="txtBOL" runat="server" Width="80px" Height="16px"></asp:TextBox>
</font>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText='' HeaderStyle-Horizontal ItemStyle-Horizontal>
<HeaderTemplate>
<%-- <asp:CheckBox runat="server" ID="chkSelectAllASN" AutoPostBack="false" onclick="SelectAllCheckboxes(this,'dg_ASN_Arrival',11);">
</asp:CheckBox>--%>
<asp:CheckBox runat="server" ID="chkSelectAllASN" AutoPostBack="false" onclick="GridSelectAllColumn(this)">
</asp:CheckBox>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkASNSelect" onclick="HighlightRow(this)"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Row Id" Visible="False">
<ItemTemplate>
<asp:TextBox ID="txtASNRowId" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PoAsnRowId")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Ebiz ASN No" Visible="False">
<ItemTemplate>
<asp:TextBox ID="txtEbizASNNo" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"EbizAsnNo")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Ebiz Lp No" Visible="False" >
<ItemTemplate>
<asp:TextBox ID="txtASNLpNo" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"EbizLpNo")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Pack Code" Visible="False" HeaderStyle-Horizontal ItemStyle-Horizontal>
<ItemTemplate>
<asp:TextBox ID="txtASNPackcode" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PackCode")) %>'
Visible="False">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid></div>
</asp:Panel>
</td>
</tr>
</table>
</td>
 

Answers (1)