Hi,
I have a page with the radgrid ,which is coded as below:
<telerik:RadGrid ID="rgSchool" ShowGroupPanel="false" ShowStatusBar="true" AllowCustomPaging="true"
RegisterWithScriptManager="true" runat="server" AutoGenerateColumns="False" AllowSorting="True"
GridLines="Vertical" OnSortCommand=" rgSchool _SortCommand" AllowMultiRowSelection="False"
AllowPaging="True" Skin="Vista" OnNeedDataSource=" rgSchool _NeedDataSource"
OnPageIndexChanged=" rgSchool _PageIndexChanged" OnPageSizeChanged=" rgSchool _PageSizeChanged"
OnItemDataBound=" rgSchool _ItemDataBound" OnGroupsChanging=" rgSchool _GroupChanging"
OnColumnHiding=" rgSchool _ColumnHidden">
<SortingSettings EnableSkinSortStyles="false" />
<PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true"></PagerStyle>
<MasterTableView Width="100%" DataKeyNames="SerialNumber, StudId,Status" ClientDataKeyNames="SerialNumber, StudId,Status"
AllowMultiColumnSorting="false" EnableHeaderContextMenu="true" AutoGenerateColumns="false"
TableLayout="auto">
<Columns>
<telerik:GridBoundColumn DataField="DateJoin" HeaderText="Date Of Joining" SortExpression="DateReceived"
Visible="true" DataFormatString="{0:MM/dd/yyyy}" />
<telerik:GridBoundColumn DataField="SerialNumber" HeaderText="Serial #" SortExpression="SerialNumber"
Visible="true" DataFormatString="{0:N0}" />
<telerik:GridBoundColumn DataField=" StudId " HeaderText="Student ID #" SortExpression=" StudId "
Visible="true" />
<telerik:GridBoundColumn DataField="Status" HeaderText="Status" SortExpression="Status"
Visible="true" />
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" EnableRowHoverStyle="true">
<Scrolling AllowScroll="false" SaveScrollPosition="true" UseStaticHeaders="true" />
<Resizing AllowColumnResize="true" EnableRealTimeResize="false" ResizeGridOnColumnResize="false"
ClipCellContentOnResize="false" AllowResizeToFit="true" />
<Selecting AllowRowSelect="true" />
<ClientEvents OnRowDblClick="RowDblClick" OnRowSelected="RowSelected" OnRowContextMenu="onRowContextMenu"
OnColumnHidden=" rgSchoolColumnHidden" OnColumnShown=" rgSchoolColumnShown" />
</ClientSettings>
<HeaderContextMenu EnableScreenBoundaryDetection="true" EnableAutoScroll="true" />
</telerik:RadGrid>
So,the users can sort,Hide,Group the columns.The sorting of the column will be done in the SP itself,based on the column(header selected).So,From the SP though get the correctly sorted data(i.e., though the DataSource is updated correctly),the grid is not STILL NOT showing the correctly sorted data.Please find the related server side code below :
protected void rgSchool_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
try
{
ViewState["CurrentPageIndex"] = rgSchool.CurrentPageIndex + 1;
//Getting the sorted,......data through SP.and storing in response object.
IEnumerable<rgSchoolReadRecord> response = WCFObj.Read(out recordCount, request);
rgSchool.DataSource = null;
rgSchool.DataSource = response;//DataSorce is updating correctly
rgSchool.VirtualItemCount = recordCount;
rgSchool.CurrentPageIndex = request.PageIndex - 1;
WCFObj.Close();
//Set the current paging and sorting in View state
ViewState["CurrentPageIndex"] = request.PageIndex;
ViewState["PageSize"] = request.PageSize;
ViewState["CurrentSort"] = request.OrderBy;
ViewState["SortDescending"] = request.Desc;
ViewState["rgSchoolSearchRequestObjet"] = request;
ViewState["recordCount"] = recordCount;
}}