Rakesh Singh

Rakesh Singh

  • NA
  • 57
  • 7.7k

How to fix the header of Gridview

Apr 22 2018 11:45 PM
I have already checked the many solutions given on Google, but there are issue with the solutions like if we will fix the header then sorting will not work(GridView sorting), please find the below code :
 
<asp:GridView ID="CostActualDetailGrid" AutoGenerateColumns="false" runat="server" UseAccessibleHeader="true" OnRowDataBound="OnRowDataBound" HeaderStyle-CssClass="HeaderCostActualDetailGrid" CssClass="CostActualDetailPopupGrid">
<Columns>
<asp:BoundField DataField="PostingDate" HeaderText="Posting<br/> Date" ControlStyle-Width="50px" HtmlEncode="false" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="TransactionDate" HeaderText="Transaction<br/> Date" ControlStyle-Width="50px" HtmlEncode="false" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="TransactionDescription" HeaderText="Transaction Decription" ControlStyle-Width="250px" ItemStyle-Horizontal />
<asp:BoundField DataField="AccountId" HeaderText="Account ID" ControlStyle-Width="50px" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="AccountDesc" HeaderText="Account Description" ControlStyle-Width="150px" ItemStyle-Horizontal />
<asp:BoundField DataField="DisplayCurrencyAmt" HeaderText="Display Currency Amount" ControlStyle-Width="50px" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="ObjectCurrencyAmt" HeaderText="Object Currency Amount" ControlStyle-Width="50px" HtmlEncode="false" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="QuantityAmt" HeaderText="Quantity/Hours" ControlStyle-Width="50px" ItemStyle-HorizontalAlign="Right" />
</Columns>
</asp:GridView>

Answers (1)