Solved

Entity Framework question  Part 2, asp.net

Posted on 2014-11-29
4
237 Views
Last Modified: 2014-11-29
As shown below, some customers have each zero or many orders. To do this, I added a template field (Orders) and inserted a gridview in it with Bindings Eval("tblOrders"). I also entered  tblOrders to Include property of EntityDataSource1 .EF_5
But in the case of Items template field, after setting  Bindings Eval("tblOrderDetails"), I do not know where and how to add tblOrderDetails so the Include property?

I am trying to display Order Details (Items) or each order. The project solution (EF_YouTube.zip about 1.1 MB with db file in it is at:  https://onedrive.live.com/?cid=420CDD6A13807C9B&id=420CDD6A13807C9B%21116 for additional information. It is developed in vs2012 and uses SQLEXPRESS12)

Question: How can I make this application to show Order_Details (Items) as well?EF6
0
Comment
Question by:Mike Eghtebas
  • 2
  • 2
4 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 40471694
Hi eghtebas;

I am not an ASP.Net developer and so I did not know how to modify this property using the smart tabin the designer so I modifyed it directly in tthe HTML.

The Include attribute needs to be modified to include all the tables you wish included. All path to a table must start from the main source which in this case is tblCustomers. So to include order details using a comma separated list of paths in the Include string you add tblOrders.tblOrderDetails as shown below.

<asp:EntityDataSource ID="EntityDataSource1" 
                      runat="server" 
                      ConnectionString="name=OrderModel" 
                      DefaultContainerName="OrderModel" 
                      EnableFlattening="False" 
                      EntitySetName="tblCustomers" 
                      Include="tblOrders, tblOrders.tblOrderDetails">
</asp:EntityDataSource>

Open in new window


The results of the change
0
 
LVL 33

Author Comment

by:Mike Eghtebas
ID: 40471726
You are amazing. Thank you very much. The last part will be to use title from tblSoftware. I will post the question shortly.

Mike
0
 
LVL 33

Author Comment

by:Mike Eghtebas
ID: 40471770
The new question is at:  http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_28571494.html

If you have the time to take a look at it.

Thanks,

Mike
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 40471800
Not a problem Mike, always glad to help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Host asp.net pages 5 25
Split in Javascript 5 30
ASP.NET 5 Templates 2 65
how can i get the executable application's path in a specific form? ('\\' instead of '\ ') 5 25
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now