How to get to the next level of Assocation in an EF4 EntityDataSource?

I've used EF4 EntityDataSources to do DataBinding with success, but here's a case where I'm stumped:

Table "CurrentComplaintsByUsers" has a foreign key over to a "Complaints" table. So in EF, I can access a CurrentComplaintByUser record, and navigate to its parent complaint like so:

var ccU = dataContext.CurrentComplaintsByUsers.First(); var parentComplaint = ccU.Complaint;

When I whip up an EntityDataSource based on CurrentComplaintsByUsers to bind a gridview, I want to get over from the "Complaint" object to an Assocation of Complaint called "Status". Here's a StatusID in my Complaint table, and so in code I can hit a complaint's status like so, including the Status properties:

string statusLabel = parentComplaint.Status.LabelText;

FAILURE: when I try to bake this all into an EntityDataSource, I can't get from my starting item "CurrentComplaintsByUsers" over to "Status". Here's my EDS:

<asp:EntityDataSource ID="edsCurrentCases" runat="server" ConnectionString="name=EOCaseDataModel" DefaultContainerName="EOCaseDataModel" EnableFlattening="False" EntitySetName="CurrentComplaintsByUsers" Include="Complaint, Status"> </asp:EntityDataSource>

My error is this:

System.InvalidOperationException "A specified Include path is not valid. The EntityType 'EOCaseApp.CurrentComplaintsByUser' does not declare a navigation property with the name 'Status'."

I'm trying to get to the point where this works in my Gridview:

<%# ((CurrentComplaintsByUser)Container.DataItem).Complaint.Status.LabelText %>

So, using declaritive markup only, how do I get to a related objects associations from the EDS? (I can do it in code, just trying to use the EDS exclusively when I can)

Other notes: if I remove "Status" from the "Include" in the EDS, then I get a NULL ERROR when it hits ..Complaint.Status.LabelText in my Gridview, pretty much what you'd expect.

-------------Problems Reply------------

Try changing Include="Complaint, Status" to Include="Complaint, Complaint.Status" in your EntityDataSource Views:1 Time:2011-03-03

Related post

  • Using NOLOCK Hint in EF4? 2010-01-26

    We're evaluating EF4 and my DBA says we must use the NOLOCK hint in all our SELECT statements. So I'm looking into how to make this happen when using EF4. I've read the different ideas on how to make this happen in EF4, but all seem like a work aroun

  • Does it still make sense to learn low level WinAPI programming? 2008-08-08

    Does it make sense, having all of the C#-managed-bliss, to go back to Petzold's Programming Windows and try to produce code w/ pure WinAPI? What can be learn from it? Isn't it just too outdated to be useful? --------------Solutions------------- This

  • Log4Net configuring log level 2008-08-08

    How do I make Log4net only log Info level logs? Is that even possible? Can you only set a threshold? This is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info? <logger name="BrokerCollec

  • Does running a SQL Server 2005 database in compatibility level 80 have a negative impact on performance? 2008-08-10

    Our software must be able to run on SQL Server 2000 and 2005. To simplify development, we're running our SQL Server 2005 databases in compatibility level 80. However, database performance seems slower on SQL 2005 than on SQL 2000 in some cases (we ha

  • IL level code debugger 2008-08-12

    Is there any IL level debugger in form of a VS plugin or standalone application? Visual studio’s debugger is great, but it allows you to debug on either HLL code level or assembly language, you can’t debug IL. It seems that in some situations it woul

  • How do you deal with transport-level errors in SqlConnection? 2008-08-19

    Every now and then in a high volume .NET application, you might see this exception when you try to execute a query: System.Data.SqlClient.SqlException: A transport-level error has occurred when sending the request to the server. According to my resea

  • get OS-level system information 2008-08-25

    I'm currently building a Java app that could end up being run on many different platforms, but primarily variants of Solaris, Linux and Windows. Has anyone been able to successfully extract information such as the current disk space used, CPU utilisa

  • What is the proper virtual directory access permission level required for a SOAP web service? 2008-08-27

    When setting up a new virtual directory for hosting a SOAP web service in IIS 6.0 on a Server 2003 box I am required to set the access permissions for the virtual directory. The various permissions are to allow/disallow the following: Read Run script

  • Substitution Control at the User Control Level? 2008-09-04

    I am trying to create some cached user controls. Basically Header and Footer are static. Except the footer has one link that reads in the url of the page and puts it into the javascript for sending a link to a friend. So I need that link to be dynami

  • When do function-level static variables get allocated/initialized? 2008-09-10

    I'm quite confident that globally declared variables get allocated (and initialized, if applicable) at program start time. int globalgarbage; unsigned int anumber = 42; But what about static ones defined within a function? void doSomething() { static

  • Using Small (1-10 Items) Instance-Level Collections in Java 2008-09-11

    While creating classes in Java I often find myself creating instance-level collections that I know ahead of time will be very small - less than 10 items in the collection. But I don't know the number of items ahead of time so I typically opt for a dy

  • What languages have higher levels of abstraction and require less manual memory management than C++? 2008-09-14

    I have been learning C++ for a while now, I find it very powerful. But, the problem is the the level of abstraction is not much and I have to do memory management myself. What are the languages that I can use which uses a higher level of abstraction.

  • How do I detect application Level Focus-In in Qt 4.4.1? 2008-09-15

    I need to determine when my Qt 4.4.1 application receives focus. I have come up with 2 possible solutions, but they both don’t work exactly as I would like. In the first possible solution, I connect the focusChanged() signal from qApp to a SLOT. In t

  • What level of complexity requires a framework? 2008-09-16

    At what level of complexity is it mandatory to switch to an existing framework for web development? What measurement of complexity is practical for web development? Code length? Feature list? Database Size? --------------Solutions------------- If you

  • Sharepoint Item Level Access & performance 2008-09-17

    i have created a workflow activity that do give the item creater of a specific list full control on the item and set everyone else to read only access (permission) someone told me that doing it this way (if i have a lot of users) the performance will

  • How should exceptions be planned at the architectural level? 2008-09-17

    Are there any good resources for planning how exceptions will be used from an architecture perspective? (Or provide your suggestions directly here.) In projects on which I have worked I find that a few common Exceptions are used over and over again a

  • What is the difference between gcc optimization levels? 2008-09-18

    What is the difference between different optimization levels in GCC? Assuming I don't care to have any debug hooks, why wouldn't I just use the highest level of optimization available to me? does a higher level of optimization necessarily (i.e. prova

  • Multiple keyboards and low-level hooks 2008-09-18

    I have a system where I have multiple keyboards and really need to know which keyboard the key stroke is coming from. To explain the set up: I have a normal PC and USB keyboard I have an external VGA screen with some hard-keys The hard keys are mappe

  • Does several levels of base classes slow down a class/struct in c++? 2008-09-19

    Does having several levels of base classes slow down a class? A derives B derives C derives D derives F derives G, ... Does multiple inheritance slow down a class? --------------Solutions------------- Non-virtual function-calls have absolutely no per

Copyright (C), All Rights Reserved.

processed in 0.107 (s). 11 q(s)