Questions tagged [entitydatasource]

EntityDataSource is an ASP.NET web server control available in .NET Framework 3.5 SP1 or later. It supports declarative data-binding of other web controls to an Entity Data Model of Entity Framework.

EntityDataSource is an ASP.NET web server control available in .NET Framework 3.5 SP1 or later.

EntityDataSource belongs to a family of server controls - like ObjectDataSource, SqlDataSource or XmlDataSource - which allow data-binding of web controls to a data source.

EntityDataSource is specifically tailored to interact with an Entity Data Model provided by Entity Framework. It supports declarative definition of CRUD operations in an ASPX web page as well as sorting, paging, data projections and various kinds of parameters to specify parametrized queries - like ControlParameter, QueryStringParameter, ProfileParameter and others.

Example

The following EntityDataSource configures data-binding to an Entity Data Model called "NorthwindEntitiesContext", selects an Order including all OrderDetails by an ID entered in a TextBox control and allows updating, inserting and deleting of Order objects:

<asp:EntityDataSource ID="NorthwindEntityDataSource" runat="server" 
    ConnectionString="name=NorthwindEntitiesContext" 
    DefaultContainerName="NorthwindEntitiesContext" 
    EntitySetName="Orders" 
    Include="OrderDetails"
    EnableUpdate="True" EnableInsert="True" EnableDelete="True"
    AutoGenerateWhereClause="True">
    <WhereParameters>
        <asp:ControlParameter Name="OrderID" ControlID="TextBoxOrderID" 
            DbType="Int32" PropertyName="Text" />
    </WhereParameters>
</asp:EntityDataSource>

Resources

159 questions
0
votes
1 answer

EntityDataSource with Code-First Entity Framework 4.1

I am just starting out on Entity Framework 4.1 Code-First. I have created my classes and DbContext, and they work perfectly fine. Right now I want to bind my ListView to my Entities, with the help of an EntityDataSource, but unfortunately it does…
0
votes
2 answers

Binding DropDownList to an EntityDataSource in EditItemTemplate of a GridView

There are a lot of questions concerning this issue, but I don't believe any address my specific issue. I have a EntitySet that is editable via a gridview. It is displaying fine. However, I have two dropdowns that are bound to handle foreign key…
Tim Hoolihan
  • 12,316
  • 3
  • 41
  • 54
0
votes
1 answer

Equivalent of e.ReturnValue in EntityDataSource

I'm using EntityDataSource with DetailsView in my ASP.NET application. I want to get identity column value after inserting the record. ObjectDataSource has e.ReturnValue property I want to know its equivalent in EntityDataSource?
hotcoder
  • 3,176
  • 10
  • 58
  • 96
0
votes
1 answer

Does EntityDatasource perform "order by" before or after query extender

Does The following entity datasource will perform orderby after filtered in each CustomExpression in queryextender or it will perform orderby first then go into each query extender before selection.
Sarawut Positwinyu
  • 4,974
  • 15
  • 54
  • 80
0
votes
0 answers

Mono - System.Web.UI.WebControls.EntityDataSource

We have a few Entity Framework projects, that we would love to get converted to Mono for mainly cross platform development purposes (as opposed to running on cross platform machines). But there appears to be a few things missing on the…
Simon
  • 1,385
  • 1
  • 11
  • 20
0
votes
2 answers

Error using QueryExtender with an EntityDataSource - 'FirstName' is not a member of type 'System.Data.Common.DbDatRecord'

The following GridView with an EntityDataSource that grabs 3 fields from the Surveyors table (which contains more fields) works, but of course it shows me every Surveyor.
Grandizer
  • 2,819
  • 4
  • 46
  • 75
0
votes
1 answer

Cannot drag and use EntityDataSource element from toolbox

I'm working on a web application on .NET4 using VS 2010. I've created an ADO.NET Entity Data Model (and put in the App_Code folder). However when trying to drag the EntityDataSource element to the Design view, nothing really happens (no…
0
votes
1 answer

An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key

Possible Duplicate: . The An object with the same key already exists in the ObjectStateManagerObjectStateManager cannot track multiple objects with the same key. I have used Entity Framework with ObjectDataSource for GridView. while i have tried…
shriji.forum
  • 15
  • 2
  • 7
0
votes
1 answer

Entity Framework Default Values

I am using an EntityDataSource with a DetailsView. How can I get one of the nullable boolean fields to default to 'checked' when inserting new items? I have tried setting a default…
simon831
  • 5,166
  • 7
  • 33
  • 50
0
votes
1 answer

Adding related entities to entity

I have two tables that have many-to-many relationship. I want to insert new object into first table same time with relations to second table objects using entityDataSource. Currently I'm using detailsView to enter data for new object of first table…
Valdars
  • 833
  • 6
  • 9
0
votes
1 answer

EntityDataSet fetch all data and then applying where clause

I am using a asp.net GridView control and setting DatasourceId to EntityDataSource as below .in the page load setting the GridDataSource.EntityTypeFilter to a View name and also adding a where clause as GridDataSource.Where = sWhereClause The…
0
votes
1 answer

How can I make Devexpress ASPxGridView get only X rows from database instead of all rows then get X?

Hi I'm using EntityDataSource with Devexpress ASPXGridView and when I was watching SQL profile I realized that 'ASPxGridView' gets all rows from database then take what it needs, even if I checked 'Show pager' and put page size to X. On the other…
Dabbas
  • 3,112
  • 7
  • 42
  • 75
0
votes
1 answer

CRUD Operations with DetailsView and EntityDataSource in Custom Server Control

I am not a big fan of ASPX pages, drag-and-drop and so on. I'm building a portal with a single Default.aspx and every other thing is custom web part controls or server controls that other developers can build in compiled dll and users can upload to…
Steven
  • 1,214
  • 3
  • 18
  • 28
0
votes
2 answers

Populating GridView using EntityDataSource and QueryString

I am new to EntityFrameWork so bear with me here. I have a webpage (page1.apsx) n page2.aspx. Page1.aspx is showing gridview of following items: EntityID Name Description Whenever user is selecting some Entity then I am passing this EntityID…
RG-3
  • 6,088
  • 19
  • 69
  • 125
0
votes
2 answers

Refresh DropDownList from EntityDataSource on change of another DropDownList

What my code does is that the EntityDataSource has a Where Parameter tied to the first DropDownList and it populates the second DropDownList, but when the first DDL changes, the EntityDataSource doesn't change the values of the second DDL. Worth…
sergioadh
  • 1,461
  • 1
  • 16
  • 24