Last post May 21, 2014 04:54 PM by __DavidO_007__
May 20, 2014 01:33 PM|__DavidO_007__|LINK
I am new to ASP.NET and Entity Framework. I have been looking around for good examples but I can't find any. I finally decided to ask a question as my last resort. I am hoping that someone here can help me with my problem.
I think the solution is there, but I just can't see it. I need to display 4 tables from an Entity Framework model in a ListView.
The model has a main table called systemUser with some basic information (userId,userFirstName, userLastName, userEmail). All of the tables have a userId. The userId is what connects all 4 tables. When I insert information I need to simultaneously insert
into all 4 tables using the same userId.
The tables are as follows:
When I display data I need to have something like the following:
userId || userFirstName || (all of systemUser) || mobilePassword || VMC || (all of companyAccess) || (moduleAccess data)
A new systemUser should have all of the information filled out in the systemUser page. The other information can exist or be null.
I am using an entitydatasource. This is the first time I use it. I was able to implement this functionality using a GridView and an SQLdatasource but I need to implement this using ListView and entitydatasource.
When I configure the entitydatasource I am only able to select one table.
I also need to perform basic CRUD operations accross all tables at once.
How can I display all of the information from the tables in the manner that I want?
May 20, 2014 06:04 PM|__DavidO_007__|LINK
So I figured out how to display the data from the various tables. All I need to implement now are the CRUD operations.
I am unsure as to where to implement those. Do I implement them using the ListView ItemInserting event or on the EntityDataSource Inserting event?
May 21, 2014 03:46 AM|Terry Guo - MSFT|LINK
There have a tutorial about the how to use entitydatasource to control data, maybe helps:
#Consuming an Entity Data Model using the EntityDataSource control (tutorial)
#Getting Started with Entity Framework 4.0 Database First and ASP.NET 4 Web Forms - Part 4
Hope it helps.
May 21, 2014 04:54 PM|__DavidO_007__|LINK
Thank you for your help. It did help a bit to clear up my confusions. I was finally able to get everything to work.