Solved

Entity Framework question  Part 2, asp.net

Posted on 2014-11-29
4
258 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 63

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 34

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 34

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 63

Expert Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 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