Solved

Entity Framework question  Part 2, asp.net

Posted on 2014-11-29
4
231 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Not a problem Mike, always glad to help.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Pass through dll 2 33
Expando 4 33
C# Application Local DB Connection String 23 56
COnsume rest client 6 4
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 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

6 Experts available now in Live!

Get 1:1 Help Now