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

ASP.net listview dropdown item getting the value from another table

I am trying to build an admin page in order to let the user create edit update the records of the specific table. "District" table has the following properties: DistrictID, DistrictName, Description, DistrictImage, CityFK. Since CityFK is just…
mctuna
  • 809
  • 3
  • 19
  • 38
0
votes
2 answers

How to 'merge' two different db tables to a single inherited class hierarchy in EF?

I have a legacy DB I'd like to writing an application for monitoring some stuff in it. The DB has a set of tables which is repeated for each 'project' in it. For example if I have 2 projects, I would have project_1_table and a similar…
0
votes
1 answer

how to set query timeout for an entitydatasource

I have a C# webform that uses a gridview bound to an EntityDataSource. Now when I run an extensive query I get a timeout on the underlying sql query. Anyone knows how to set the query timeout using EntityDataSource? I found a few articles that state…
Edoardo
  • 95
  • 10
0
votes
2 answers

How to pass DropDownList SelectedItem into the EntityDataSource Select Attribute

I am trying to pass the selected value of ddlCity dropdownlist into the EntityDataSource2 CommandText where "WHERE p.city = @city" but I get the following error: WhereParameters cannot be specified unless AutoGenerateWhere==true or Where is…
mctuna
  • 809
  • 3
  • 19
  • 38
0
votes
1 answer

Where parameters in EntitydataSource from dropdown control

Using the following markup, my details view is not populating when the dropdown is selected. The id for the where parameter is to come from the dropdwon selected value.It appears that the control parameter is not functioning…
dinotom
  • 4,990
  • 16
  • 71
  • 139
0
votes
0 answers

ASP.NET GridView not saving when textbox is empty

I have a GridView that is editable with an entitydatasource, if my users want to delete the text in one of the fields they cannot. They can replace the text with a space which then saves, but if the textbox is completely empty the save operation…
Gordon Copestake
  • 1,616
  • 4
  • 21
  • 37
0
votes
1 answer

Entity DataSource Where parameter

I have and entity datasource and i would like to add a where parameter so as to filter information. I have a gridview with a list of items and on checking a checkbox and hitting edit button, it sends you to a different view where there is a…
Dineshp
  • 31
  • 1
  • 11
0
votes
1 answer

EntityDataSource arbitrary join

Is there a way to use an entitydatasource that has an arbitrary join as the source for an editable gridview? I am using entity-framework and linq to sql. I would like a gridview that is currently editable using the "built in" edit mode and paging to…
Gordon Copestake
  • 1,616
  • 4
  • 21
  • 37
0
votes
1 answer

EntityDataSource accessing a collection from another entity in GridView

I'm not sure if my title accurately describes what I'm trying to do. I have two tables in my Entity Framework, person and user. I am trying to display a grid of users, so I set up this EntityDatasource:
RMS2
  • 707
  • 3
  • 8
  • 19
0
votes
1 answer

Drop Down List make list item requery entitydatasource

My first post here and Iam an absolute beginner. Searched the web for hours. I feel that I might have approached my problem the wrong way, but here goes. I have a Datasource that displays Loans (assets) in a Gridview. I would like to have a ddl to…
0
votes
1 answer

EntityDataSource Executes the Query twice

I have a page that binds data from an EntityDataSource to a paged ASP.NET ListView. The query is actually a fairly complex query and I don't know that an EDS is really the way to go but it's inherited code and I am hoping to resolve this issue…
Gary O. Stenstrom
  • 2,284
  • 9
  • 38
  • 59
0
votes
1 answer

Converting MaterializedDataRecord to an entity or why does EntityDataSource break my entity

I'm using an EntityDataSource. When I leave the "Select" property blank, all works great - in SomeWebControl_DataBinding I can perfectly convert the DataItem of the GridRow to my Entity (let's call it USERS). Literal ctrlTime =…
daniel
  • 1
  • 1
0
votes
1 answer

Null Reference to Entity Association when overriding ToString in partial class - EntityDataSource.Include is being ignored

I am using Dynamic Data for Entity Framework, unfortunately I'm stuck on .NET 3.5, so it's EF1, and at the moment this cannot change. So my problem is this, I have tried adding the EntityDataSource.Include property in a couple of ways to deal with…
m4chine
  • 431
  • 1
  • 7
  • 16
0
votes
1 answer

Entity datasource filter

I have an entity datasource and i would like to filter it (created_on) to show only the max date. How do i go about doing it?
Dineshp
  • 31
  • 1
  • 11
1 2 3
10
11