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
3
votes
2 answers

How Can Access Label In Repeater

im try to access label in repeater to get value and set another value in same label
3
votes
1 answer

How do I get the EntityDataSource to allow me to access child entities?

I have a very simple mockup I'm making for a client that uses the Northwind database. I have an EDMX file with three entities: Products, Categories, and Suppliers. I'm trying to create a page that has a GridView that shows the products, including…
Scott Mitchell
  • 8,659
  • 3
  • 55
  • 71
3
votes
0 answers

EntityDataSource empty when using Paging with GridView

I have searched around trying to find an answer to this, but have not found a solution so far. I am trying to use an EntityDataSource with a GridView (C#). The GridView is not populated initially on Page_Load as I want the user to select some…
3
votes
2 answers

How to programmatically set parameters for EntityDataSource and DetailsView?

Im stumped! What is the best way to programmatically set a selecting parameter for the EntityDataSource control? Specifically, I want to use the Page.User.ProviderUserKey to get a record in a custom User Details table I have, for a DetailsView. I've…
John B
  • 20,062
  • 35
  • 120
  • 170
2
votes
2 answers

.NET: Abstracting away the datasource and datacontext

I'm trying to write reusable components for my most common dev scenarios: I have made a general purpose presentation-layer to present domain-objects and data-objects (dc-serializable) to be encapsulated in the domain-objects. I also have some kind…
2
votes
1 answer

How to access data in EntityDataSource programmatically

I have an EntityDataSource bound to many filters used by gridview data, I want to have access to the entities that was selected be the EntityDataSource to be able to export them in xml for example, how can I do that?
Andron
  • 223
  • 1
  • 3
  • 14
2
votes
1 answer

Problems with Entity Framework and EntitiyDataSource

I have simple scenario: Web Project(C#) with added dll reference to below DataSource project. Separate DataSource project (Class Library) where I added edmx file and generated POCOs with DbContext Generator. Really, nothing special. I think every…
bobetko
  • 5,019
  • 14
  • 58
  • 85
2
votes
2 answers

Insert/Update/Delete is disabled for this control. message of EntityDataSource

I use ASPxGridView and EntityDataSource as its datasource. In EntityDataSource, I write CommandText, so I can not set "EnableInsert", "EnableUpdate", or "EnableDelete" to true. That's why, I manipulate (insert, update, delete) data manually. Changes…
Ypci
  • 21
  • 1
  • 4
2
votes
3 answers

Get primary key column value after inserting record using DetailsView and EntityDataSource

I'm using DetailsView with EntityDataSource and binding EntityDataSource directly with Entity Model. I want to get the primary key value after record has been inserted. How can I get it either in protected void detailsVewUser_ItemInserted(object…
hotcoder
  • 3,176
  • 10
  • 58
  • 96
2
votes
1 answer

How to sort with a CASE statement in an EntityDataSource?

I'm using a CASE statement in my EntityDataSource to do custom sorting. Consider the following code:
Kees C. Bakker
  • 32,294
  • 27
  • 115
  • 203
2
votes
1 answer

Error with automatic delete when RadGrid is bound to EntityDataSource

I have a RadGrid that's bound to EntityDataSource. A few of the columns are bound to navigation properties of the bound entity. When I try to delete a record, it gives the following error: Error: Sys.WebForms.PageRequestManagerServerErrorException:…
Chuck
  • 332
  • 4
  • 15
2
votes
1 answer

How can I use the property of an object stored in a session variable as a WhereParameter in an EntityDataSource?

Good morning! I am using an EntityDataSource and would like to filter it with a WhereParameter that is a property of a object stored in a session variable, Session("Ticket"). Is this possible? Here's the class I use for a Ticket object that gets…
Carlos Mendieta
  • 860
  • 16
  • 41
2
votes
2 answers

Randomize OrderBy with EntityDataSource

I am getting a list of people in a EntityDataSource and binding this to a repeater. I want to order them randomly so the people are not always displayed in the same order. What options do I have to do this?
simon831
  • 5,166
  • 7
  • 33
  • 50
2
votes
2 answers

Displaying Navigation Properties on a GridView using EntityDataSource?

I have an EntityDataSource I've mapped to the entity Resident which includes two navigation properties (Building1, Room1). I've set my GridView to use this EntityDataSource and set the EntityDataSource Include property to Building1, Room1 so it…
Dave Mackey
  • 4,306
  • 21
  • 78
  • 136
2
votes
1 answer

EntityDataSource Null Update Pameters not getting marked Modified

I am using an EntityDataSource with a FormView on VB.NET application. The FormView contains an AjaxControlToolKit TabContains with multiple tabs. Due to the fact that each tab is a naming container, Bind doesn't work properly for updating values (as…
1
2
3
10 11