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

commandtext query in asp.net

I have a month and year variables and I am getting datas with this query. EntityDataSourcePersonel.CommandText = "SELECT COUNT(TeklifTable.TeklifHazirlayan) AS Basari, EmployeeTable.Name, EmployeeTable.Surname, SUM(TeklifTable.TeklifTutar) AS…
Koray Durudogan
  • 624
  • 4
  • 12
  • 31
0
votes
1 answer

How to prevent insertion in FormView?

I want to check my form before inserting to prevent insert duplicate ProductSerial in my data base. so how can i check the txtProductSerial.text with my database and if it is duplicate I PREVENT INSERTION. This are my codes protected void…
Amin AmiriDarban
  • 2,031
  • 4
  • 24
  • 32
0
votes
1 answer

take a float from codebehind and use it in view

I need to make an filter operation in the view of my project.
Koray Durudogan
  • 624
  • 4
  • 12
  • 31
0
votes
1 answer

GUID parameter for entitydatasource in asp.net

I want to know how I can set a GUID parameter for my entitydatasource. This is what I have currently:
Laziale
  • 7,965
  • 46
  • 146
  • 262
0
votes
0 answers

Strange behaviour recovering multiple columns as a single field in EntityDataSource

I'm using this EntityDataSource in a aspx page to retrieve some data from my database:
Kitinz
  • 1,522
  • 3
  • 17
  • 28
0
votes
1 answer

Multi-level data sources using entity framework

I am trying to use EF to build a devexpress gridview that as multi-level display. I use the Data Sources in VS 2013 following the following steps: Add New Data Source Data Source Type: Object Data Bind to: SP_User Here is my DB tables Now the…
Juan Gous
  • 249
  • 1
  • 2
  • 20
0
votes
1 answer

Asp:EntityDataSource: Make a insentitive diacritics search in where clause

I can't figure out how to do this. I have a Gridview bind on a asp:EntityDataSource. This asp:EntityDataSource returns me a list of employe and the EntityDataSource can be filtered by a textbox on the name of the employee. I'm looking for a way to…
Janick Isabelle
  • 434
  • 7
  • 18
0
votes
1 answer

Radgrid data is empty after updating record

I have a radgrid binded with entity datasource.Everything works well except that when I update record from code behind on updateCommand the data is lost from grid and in database the record is updated.please help with this.below is the code for…
0
votes
2 answers

EntityDataSource Filtering

This is a little painful, I feel like this should be really easy. I have a EntityDataSource as such:
Brad Mc
  • 151
  • 1
  • 13
0
votes
2 answers

EntityDataSource Where?

I have a entitydatasource connecting to my database and I want to filter the results using the "Where" property. As a test I have the following: it.CustomerID is not 6 And I get the following error: The query syntax is not valid. Near term '6',…
user1157885
  • 1,999
  • 3
  • 23
  • 38
0
votes
1 answer

How do I use EntityDatasource (Or LinqDatasource) with a Union clause

How do I combine records from two tables in an Entitydatasource control? I have googled it and searched on SO with no luck. The SQL of what I need is SELECT DISTINCT username FROM (SELECT s.username FROM project_stakeholders s UNION SELECT…
Simua
  • 263
  • 1
  • 10
0
votes
1 answer

Filtering data using EntityDataSource (dropdownlist)

I have a drop down list that is using entitydatasource, the user select a value form drop down list and the Grid View change based on the Order Status (Drowpdownlist). Below is the grid view DataSource. It works but when I go to page 4 for example…
user3798891
  • 15
  • 1
  • 2
0
votes
1 answer

"Current" object of an asp:FormView bound to an EntityDataSource

I have a FormView with paging enabled. The FormView is bound to an EntityDataSource ...
Slauma
  • 175,098
  • 59
  • 401
  • 420
0
votes
1 answer

Searching GridView

I am trying to make searchable GridView. it's DataSource is EntityDataSource. I have one textbox and a button. The problem is I need to use Linq to access the data. I don't really have any code yet, because I'm net at Linq and not sure what I'm…
hollyquinn
  • 652
  • 5
  • 15
  • 48
0
votes
1 answer

How do I prevent EntityDataSource to execute a query if controlparameters are invalid?

On an ASP.NET web page I have an EntityDataSource:
Slauma
  • 175,098
  • 59
  • 401
  • 420