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

RadGrid with EntityDataSource Filtering

1 Answer 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Imran
Top achievements
Rank 1
Imran asked on 22 Jan 2016, 07:20 PM

I have an EntityDataSource

 

<asp:EntityDataSource
    ID="InventoryEntityDataSource"
    runat="server"
    ConnectionString="name=myEntities"
    DefaultContainerName="myEntities"
    EnableFlattening="False"
    EntitySetName="Inventory"
    Select="it.[InventoryID],
            it.[InventorySalesRepUserID],
            it.[SalesRep_Table].[DisplayName] AS SalesRep_DisplayName,
            "
    EntityTypeFilter=""
    OrderBy="it.[InventoryID]">
</asp:EntityDataSource>

And RadGrid

<telerik:RadGrid
        ID="InventoryRadGrid"
        runat="server"
        AutoGenerateColumns="False"
        DataSourceID="InventoryEntityDataSource"
        AllowFilteringByColumn="True"
        AllowPaging="True"
        AllowSorting="True"
        ShowGroupPanel="True"
        Width="100%"
        ShowFooter="True"
        GroupPanelPosition="Top"
        ResolveRenderMode="Classic"
        CellSpacing="-1"
        GridLines="Both">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <GroupingSettings CaseSensitive="false" />
        <MasterTableView
            DataSourceID="InventoryEntityDataSource"
            DataKeyNames="InventoryID"
            EnableViewState="true"
            TableLayout="Fixed">
            <Columns>
                <telerik:GridTemplateColumn
                    DataField="InventoryID"
                    SortExpression="InventoryID"
                    DataType="System.Int32"
                    FilterControlAltText="Filter InventoryID column"
                    HeaderText="Item #"
                    UniqueName="InventoryID"
                    Visible="False">
                    <ItemTemplate>
                        <asp:HyperLink
                            ID="HyperLink1jkl"
                            runat="server" Text='<%# Eval("InventoryID") %>'
                        </asp:HyperLink>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                 
                <telerik:GridBoundColumn
                    DataField="InventorySalesRepUserID"
                    FilterControlAltText="Filter InventorySalesRepUserID column"
                    HeaderText="Sales Rep ID"
                    UniqueName="InventorySalesRepUserID"
                    Visible="False"
                    SortExpression="InventorySalesRepUserID">
                </telerik:GridBoundColumn>
                 
                <telerik:GridBoundColumn
                    DataField="SalesRep_DisplayName"
                    FilterControlAltText="Filter InventorySalesRepUserName column"
                    HeaderText="Sales Rep Name"
                    UniqueName="InventorySalesRepUserName"
                    Visible="False"
                    SortExpression="SalesRep_DisplayName">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
</telerik:RadGrid>

It loads fine and filter on radgrid also works fine when filtering InventoryID and SalesRepID but when i filter for SalesRep_DisplayName give me an error.

'SalesRep_DisplayName' is not a member of type 'myDB_Model.tblInventory' in the currently loaded schemas. Near simple identifier.

 

 

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 28 Jan 2016, 06:35 AM
Hello,

Note that the described behavior is expected as the mentioned field is mapped and is added as data filed, but the RadGrid is searching for such original data filed in the model which is actually missing.Therefore you should remove the mapping and bind to the actual data field in order to avoid this error.

Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Imran
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or