When you sort a column in a Telerik RadGrid you get the error “Cannot find column Customer”, make sure the  SortExpression is the same as the DataField

                   DataField="Customer.Description"
                   HeaderText="Customer"
                   SortExpression="Customer.Description"
                   UniqueName="Customer" 


If SortExpression is not the same as the DataFiel, you will get the error:

Message: Cannot find column Customer

Exception: System.IndexOutOfRangeException

Targetsite: System.Data.IndexField[] ParseSortString(System.String)

Source: System.Data

StackTrace: at System.Data.DataTable.ParseSortString(String sortString)

at System.Data.DataView.CheckSort(String sort)

at System.Data.DataView.set_Sort(String value)

at Telerik.Web.UI.GridEnumerableFromDataView.PerformTransformation()

at Telerik.Web.UI.GridEnumerableFromDataView.TransformEnumerable()

at Telerik.Web.UI.GridTableView.GetEnumerator(Boolean useDataSource, GridEnumerableBase resolvedDataSource, ArrayList dataKeysArray)

at Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource)

at Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource)

at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)

at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)

at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)

at System.Web.UI.WebControls.DataBoundControl.PerformSelect()

at Telerik.Web.UI.GridTableView.PerformSelect()

at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()

at Telerik.Web.UI.GridTableView.DataBind()

at Telerik.Web.UI.GridSortCommandEventArgs.ExecuteCommand(Object source)

at Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e)

at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)

at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)

at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)

at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)

at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)

at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)

at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)

at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Data count: 0

3 Comments

  1. Hello,

    I am using llblgen in combination with telerik.

    But when i bind my entitycollection to my grid it works 🙂

    still i have 1 problem:

    example:
    EntityCollection masterList = ContactenBL.GetContacten();

    radGridView1.DataSource = masterList;

    but when i need the language text inside that object it’s not visible

    I use prefetchpath to add the language text.

    How do you get that text visible inside the grid ?

    i tried something like this:

    column name datafield / Result
    ———————————————-
    LanguageID –> (this is visible inside grid)
    Languages.Language –> this field is not detected.

    I would like to use the entitycollection instead of dataset.

    Is this possible ?

    Kris
  2. If you use the correct prefetch path the you could use the Languages.Language propery as datafield for you’re datagrid column and you can you’s the entiycollection directly as datasource, refer to the telerik documentation on how to use entitycollection as datasource.

    Roel van Lisdonk

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.