SearchResultGrid.MasterTableView.CurrentPageIndex = 0;
GridSortExpression ge = new GridSortExpression();
ge.FieldName =
"CustomerID";
ge.SortOrder =
GridSortOrder.Descending;
SearchResultGrid.MasterTableView.SortExpressions.Add(ge);
SearchResultGrid.Rebind();
The code above sorts the data in the grid with no issues... However, it does not select the column and visually show that it is sorted. Here is the grid code:
<
telerik:RadGrid ID="SearchResultGrid" EnableAJAX="False" ShowStatusBar="True" PageSize="25" Width="99%" AllowPaging="True"
AllowSorting="True" runat="server" Skin="Green" EnableEmbeddedSkins="false" GridLines="Both" OnNeedDataSource="SearchResultGrid_NeedDataSource">
<clientsettings allowkeyboardnavigation="True">
<Selecting AllowRowSelect="false" />
<Resizing AllowColumnResize="True" AllowRowResize="False" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" />
<ClientEvents OnActiveRowChanged="ActiveRowChanged" OnRowSelected="RowSelected" OnKeyPress="GridKeyPressed"/>
</clientsettings>
<mastertableview autogeneratecolumns="false" clientdatakeynames="CustomerID,SiteID">
<Columns>
<telerik:GridTemplateColumn UniqueName="CustomerID" HeaderText="Customer" SortExpression="CustomerId" >
<itemtemplate>
<a href="javascript:document.getElementById('SearchTracker').value = '0';CloseWindowWithArgument('<%# Eval("CustomerID")+"','"+ Eval("SiteID") %>');"><%# Eval("CustomerId") %></a>
</itemtemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn Visible="false" HeaderText="Customer" UniqueName="ExportCustomerID" DataField="CustomerId" DataFormatString="{0} " SortExpression="CustomerId"/>
<telerik:GridBoundColumn HeaderText="Site Id" HeaderStyle-Width="5%" DataField="SiteID" UniqueName="SiteID" DataFormatString="{0} " SortExpression="SiteID" />
<telerik:GridBoundColumn HeaderText="Customer Name" HeaderStyle-Width="30%" DataField="CustomerName" UniqueName="CustomerName" SortExpression="CustomerName" />
<telerik:GridBoundColumn HeaderText="Address" HeaderStyle-Width="30%" DataField="AddressLine1" UniqueName="Address" SortExpression="AddressLine1" />
<telerik:GridBoundColumn HeaderText="City" HeaderStyle-Width="20%" DataField="City" UniqueName="City" SortExpression="City" />
<telerik:GridBoundColumn HeaderText="State" HeaderStyle-Width="5%" DataField="State" UniqueName="State" SortExpression="State" />
</Columns>
<NoRecordsTemplate>
<div class="NoRecordText">No records to display.</div>
</NoRecordsTemplate>
</mastertableview>
<pagerstyle mode="NumericPages" AlwaysVisible="true" />
</telerik:RadGrid>
The grid is in a table cell, in a div. How can I get the grid to visually show the sort expression?
Thanks,
- Adam
