• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1464
  • Last Modified:

EntityDataSource question ~ HELP

I am very new to EntityDataSource, If I have two tables

Company -
CompanyID
CompanyName

CompanySalesStaff-
CompanyID
SalesID

I want to show all the customer based on the SalesID that user select. How Do I approach that? I tried serveral way it doesn't work. Any Suggestion?

It is what I have

 <asp:EntityDataSource ID="eds_customer" runat="server" ConnectionString="name=NamsingMatrixCRM_ED"
        DefaultContainerName="NamsingMatrixCRM_ED" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="Companies" 
        EntityTypeFilter=""
        Where="it.CustomerSalesStaffs.[SalesID] = @SalesID">
        <WhereParameters>
            <asp:ControlParameter ControlID="RadComboBox1" DbType="Guid" Name="SalesID" 
                PropertyName="SelectedValue" />
        </WhereParameters>
    </asp:EntityDataSource>

Open in new window


I always got this error

'SalesID' is not a member of 'Transient.collection[xxx.model.CustomerSalesStaff(Nullable=True,DefaultValue=)]'. To extract a property of a collection element, use a subquery to iterate over the collection.

0
cj_skywalker
Asked:
cj_skywalker
  • 2
2 Solutions
 
NavneetSoftware EngineerCommented:
Or You can have


 <asp:EntityDataSource ID="eds_customer" runat="server" ConnectionString="name=NamsingMatrixCRM_ED"
        DefaultContainerName="NamsingMatrixCRM_ED" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="Companies" Include="CompanySalesStaff"
        EntityTypeFilter=""
        Where="it.CustomerSalesStaffs.[SalesID] = @SalesID">
        <WhereParameters>
            <asp:ControlParameter ControlID="RadComboBox1" DbType="Guid" Name="SalesID"
                PropertyName="SelectedValue" />
        </WhereParameters>
    </asp:EntityDataSource>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now