Now that you have and entity data model you can create a web
form that will use this model.
Right click on the web site in the Solution Explorer and select Add New
Item… from the pop-up menu.
Select Web Form from the list of templates and leave the name of the
file set to Default.aspx. click the Add button
The Default.aspx web form will be added to your project and the markup
is displayed. Switch your view to Design mode.
Expand the Data node in your toolbox and you should see the
EntityDataSource control. Drag this control onto your web form. You can drop
it anywhere on the form.
Click the smart tag on the EntityDataSource control and select Configure
Data Source from the pop-up menu. The Configure Data Source wizard will
Choose AdventureWorksEntities from the list of Named Connections. The
DefaultContainerName will default to AdventureWorksEntities. Click the Next
Select Contacts for the EntitySetName and select Contacts for the
Check the boxes to enable updates and deletes.
Click the Finish button.
entity data source is now configured so it can be bound to a GridView control.
Drag a GridView control onto the form.
the smart tag to display the pop-up menu next to the GridView if it doesn't
appear by default.
the Choose Data Source list to EntityDataSource1.
the boxes next to Enable Paging, Enable Editing and Enable Deleting.
the Edit Columns… link from the pop-up menu. You should see all of the fields
listed in the Selected Fields list.
on the ContactID field and change its Visible property to False. Do the same
for the NameStyle, EmailPromotion, Phone, PasswordHash, PasswordSalt,
AdditionalContactInfo, rowguid, and ModifiedDate fields. Click the OK button.
web form should look like the following image.
click on the Default.aspx page and set it as the start up page. Run your
project by pressing F5.
get a message asking if you want to modify the web.config file to enable debugging.
Click the OK button.
The web page should be displayed with the list of contacts
in the table. If you click on the Edit link each cell in that row will become
a textbox and you'll be able to change the value. To commit the changes to the
database click the Update link.