I have a gridview that should allow sorting on all columns and works well aside from the first column. All column headers are clickable and sortable. On the first column however the sortExpression doesnt work. This is happening throughout the program that I am working on. Here is a clip of the code I am using.
<asp:GridView ID="gdvDeposit" runat="server" AutoGenerateColumns="False"
CssClass="table table-striped table-condensed table-hover table-bordered dataTable-paging"
SortedAscendingHeaderStyle-CssClass="sorting_asc" SortedDescendingHeaderStyle-CssClass="sorting_desc" PageSize="100" AllowPaging="True" AllowSorting="True"
DataSourceID="ldsDeposit">
<Columns>
<asp:TemplateField HeaderText="Deposit #" SortExpression="DepositCode" >
<ItemTemplate>
<asp:Label runat="server" ID="lblDepositNumber" Text='<%# Eval("DepositCode") %>' />
<asp:Label runat="server" Text='<%# Eval("Id") %>' Visible="false" />
<asp:HyperLink runat="server" NavigateUrl='<%# "~/Accounting/DepositEdit.aspx?Id=" + Eval("Id") %>'><i class="fa fa-pencil pull-right gdv-hover-icon" data-toggle="tooltip" data-placement="top" title="" data-original-title="Edit"></i></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DepositTypeName" HeaderText="Type #" ReadOnly="true" SortExpression="DepositTypeName"></asp:BoundField>
<asp:BoundField DataField="DepositDate" HeaderText="Date" DataFormatString="{0:d}" ReadOnly="True" SortExpression="DepositDate"/>
<asp:BoundField DataField="Amount" HeaderText="Amount" ReadOnly="true" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="Right" SortExpression="Amount"></asp:BoundField>
<asp:BoundField DataField="PaymentsTotal" HeaderText="Payment Total" ReadOnly="true" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="Right" SortExpression="PaymentsTotal"></asp:BoundField>
<asp:BoundField DataField="NumberOfPayments" HeaderText="# of Payments" ReadOnly="true" SortExpression="NumberOfPayments"></asp:BoundField>
<asp:TemplateField HeaderText="Balanced" SortExpression="Balanced">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:Label runat="server" ID="lblPaid" Visible='<%# Eval("Balanced")%>'><i class="fa fa-check text-center"></i></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Deposited" SortExpression="Deposited">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkSelect" Checked='<%# Eval("Deposited")%>' AutoPostBack="True" OnCheckedChanged="chkSelect_OnCheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>