This is a migrated thread and some comments may be shown as answers.

Error When Sorting the grid

1 Answer 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mesha
Top achievements
Rank 1
mesha asked on 23 Oct 2008, 04:07 PM
Hi,

I am getting following error when i try to sort the grid.

Actually, the sort expression is different from the columnname.

ex:
e.Column.HeaderText = "FLD_1"
e.Column.SortExpression="Agreement"

Is it possible to have the sortexpression and headertext with 2 differents names?

Please help me and following is the error i am getting... 

Server Error in '/FSNET' Application.

Cannot find column Agreement Reference.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Cannot find column Agreement Reference.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[IndexOutOfRangeException: Cannot find column Agreement Reference.]
   System.Data.DataTable.ParseSortString(String sortString) +1799673
   System.Data.DataView.CheckSort(String sort) +28
   System.Data.DataView.set_Sort(String value) +131
   Telerik.Web.UI.GridEnumerableFromDataView.PerformTransformation() +4496
   Telerik.Web.UI.GridEnumerableFromDataView.TransformEnumerable() +33
   Telerik.Web.UI.GridTableView.GetEnumerator(Boolean useDataSource, GridEnumerableBase resolvedDataSource, ArrayList dataKeysArray) +156
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +330
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +502
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +59
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +111
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +29
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
   Telerik.Web.UI.GridTableView.PerformSelect() +23
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
   Telerik.Web.UI.GridTableView.DataBind() +321
   Telerik.Web.UI.GridSortCommandEventArgs.ExecuteCommand(Object source) +271
   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +171
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +57
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +147
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +163
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Many Thanks,
Shashi

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Oct 2008, 07:06 AM
Hi,

I have tested it and there is no issue if you set the header text and sort exprression to two different names. The error does occur though when you set  the sortexpression  to a column name that doesnot exist in the datasource of your grid. Please make sure that you have selected the column "Agreement "

Thanks,
Princy

Tags
Grid
Asked by
mesha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or