Cannot sort by extended property of an entity partial class

Posts   
 
    
Gianc1412
User
Posts: 40
Joined: 30-Oct-2007
# Posted on: 03-Dec-2010 02:34:59   

I'm using 2.6.10.0917 Self Servicing

I have an Entity called StorageUnitEntity that I extended using a partial class:

   public partial class StorageUnitEntity
    {
        public string DimensionLiteral
        {
            get { return string.Format("{0}' x {1}'", this.Length, this.Width); }
        }

I'm also using a RadGrid bound to a LLBLGENDatasource

            <Columns>
                <telerik:GridBoundColumn DataField="SquareFootageLiteral" 
                    HeaderText="SquareFootageLiteral" SortExpression="SquareFootageLiteral" UniqueName="SquareFootageLiteral">
    <llblgenpro:LLBLGenProDataSource ID="LLBLGEN_StorageUnits" runat="server" 
        DataContainerType="EntityCollection"         EntityCollectionTypeName="DAL.CollectionClasses.StorageUnitCollection, DAL">
    </llblgenpro:LLBLGenProDataSource>

I can see the values in the column rows but when I try to sort I get the error:

Invalid column name 'SquareFootageLiteral'. 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.Data.SqlClient.SqlException: Invalid column name 'SquareFootageLiteral'.

Do I have to set a custom property in the generator?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Dec-2010 04:50:12   

Your custom property is not a DB field, so it's client-side. You sould set the LLBLGenProDataSource SortingMode to ClientSide. Please take a look to this:

Databinding and SortingMode

http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=13171

David Elizondo | LLBLGen Support Team