web 2.0

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource The EntityDataSource represents an Entity Data Model (EDM) to data-bound controls in an ASP.NET application.

ShotDev Focus:
- ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Tag Control :


<asp:EntityDataSource ID="EntityDataSource1" runat="server"></asp:EntityDataSource>

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

On current project Right Click -> Add New Item

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Add New Item ADO.NET Entity Data Model.

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Click Yes . for Move code to folder ‘App_Code’

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Entity Data Model Wizard -> Generate form database. -> Next

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Choose your data connection or create New Connection…

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

If new create new connection. Choose Microsoft SQL Server

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Connection Properties (Server name,Lo on to the server , Connect to a database)

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Click Next > for go to next step.

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Choose your database object. (Entity Data Model)

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Entity Data Model From creating.

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Drag EntityDataSource Control to ASP.NET Web Form. On EntityDataSource Tasks -> Configure Data Source…

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Configure ObjectContext Select Name Connection form Entities Data Source.

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Configure Data Selection. (EntitySetName m EntityTypeFilter)

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

Drag GridView Control to ASP.NET Web Form and Choose Data Source EntityDataSource (Enable : Paging, Sorting, Editing, Deleting, Selection)

Example

EntityDataSource.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="EntityDataSource.aspx.vb" Inherits="EntityDataSource" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=mydatabaseEntities"
DefaultContainerName="mydatabaseEntities" EnableDelete="True"
EnableFlattening="False" EnableInsert="True" EnableUpdate="True"
EntitySetName="customers">
</asp:EntityDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CustomerID"
DataSourceID="EntityDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ShowSelectButton="True" />
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True"
SortExpression="CustomerID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
<asp:BoundField DataField="CountryCode" HeaderText="CountryCode"
SortExpression="CountryCode" />
<asp:BoundField DataField="Budget" HeaderText="Budget"
SortExpression="Budget" />
<asp:BoundField DataField="Used" HeaderText="Used" SortExpression="Used" />
</Columns>
</asp:GridView>

</div>
</form>
</body>
</html>

EntityDataSource.aspx.vb

Partial Class _Default
Inherits System.Web.UI.Page

End ClassPartial Class EntityDataSource
Inherits System.Web.UI.Page

End Class

Screenshot

ASP.NET(vb.net) & EntityDataSource - asp:EntityDataSource

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.