I am quite new to Asp.net. I am using custom paging in asp:gridview in a project (C#). I wanted to fix my gridview header (freeze or scroll-able header so that user can see header while scrolling down to the rows). I have read different solutions on internet but still unable to figure out the solution. Will be very happy if someone can guide me, thanks.
Following is my gridview code :
<div style="overflow:scroll;width:1200px; height:500px;" >
<asp:GridView ID="ResultGridView" runat="server" CellPadding="4" OnRowCommand="ResultGridView_OnRowCommand" Font-Size="Small" Width="100%" ShowHeaderWhenEmpty="True" AutoGenerateColumns="False" AllowCustomPaging="True" AllowPaging="True" OnPageIndexChanging="ResultGridView_PageIndexChanging" >
<AlternatingRowStyle BackColor="White" HorizontalAlign="Left" Wrap="False"/>
<EditRowStyle BackColor="#7C6F57" CssClass="alt"/>
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" Wrap="false" />
<PagerSettings Mode="NumericFirstLast" FirstPageText="First" LastPageText="Last"/>
<PagerStyle CssClass="gridViewPager" BackColor="#666666" ForeColor="White" HorizontalAlign="Left" Font-Size="Small" VerticalAlign="Middle" Wrap="False" />
<RowStyle BackColor="#E3EAEB" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F8FAFA" />
<SortedAscendingHeaderStyle BackColor="#246B61" />
<SortedDescendingCellStyle BackColor="#D4DFE1" />
<SortedDescendingHeaderStyle BackColor="#15524A" />
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:Button ID="DetailsButton" title="Click this button to edit / add bioactivity information" CssClass="bt" runat="server" CausesValidation="false" CommandName="DetailsButton" Text="Edit" CommandArgument='<%# String.Format("{0}", Eval("RowNumber")) %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="RowNumber" HeaderText="Row ID" htmlencode="false" ItemStyle-CssClass="gridView_hiddencol" HeaderStyle-CssClass="gridView_hiddencol" />
<asp:BoundField DataField="Compound_ID" HeaderText="Compound ID" htmlencode="false" />
<asp:BoundField DataField="Compound_Name" HeaderText="Compound Name/Syn" ItemStyle-Wrap="false" htmlencode="false" />
<asp:BoundField DataField="Target_ID" HeaderText="Target ID" htmlencode="false" ItemStyle-Wrap="false" />
<asp:BoundField DataField="Target_Pref_Name" HeaderText="Target Pref. Name" ItemStyle-Wrap="false" htmlencode="false" /> <asp:BoundField DataField="PUBMED_ID" HeaderText="PubMed ID" htmlencode="false" ItemStyle-CssClass="gridView_hiddencol" HeaderStyle-CssClass="gridView_hiddencol"/>
</Columns>
</asp:GridView>
</div>