entitydatasource

How do I create a nested GridView bound to parent's EntityDataSource's navigation property?

<asp:FormView DataSourceId="edsAccounts"> <ItemTemplate> <asp:TextBox Text='<%# Eval("Email") %>' /> <asp:DataGrid ID="dgReports" DataSource='<%# Eval("Reports") %>'> </ItemTemplate> </asp:FormView> <asp:EntityDataSource ID="edsAccounts" runat="server" ConnectionString="name=Entities" DefaultContainerName="Entitie...

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 seen code using the asp:ControlParameter to pull a value from a control, but that almo...

How to populate an updateable FormView from an EntityDataSource with filter.

I'm trying to create a member page for updating account details. I want to populate a form with the member's data, but I don't know how to set a filter on the EntityDataSource to limit the query. When I set the select statement based on the member ID, I get the error Select cannot be set if EnableDelete, EnableInsert, or EnableUpdate...

Server Tags in DataSource

Is Possible to put some server tag in Session Field to access a constant string??? <asp:EntityDataSource ID="EntityDataSourceProcesos" runat="server" ConnectionString="name=Entities" DefaultContainerName="Entities" EntitySetName="PROCESO" EntityTypeFilter="PROCESO" Select="it.[DE_PROC], it.[ID_PROC], it.[ST_PROC]" Where...

Accessing details data using EntityDataSource

I have a grid bound to an EntityDataSource. I'm listing some values of an entity. Now I need to add a column to this listing where value would be from this entity related entity. The first value from this collection. Is this posible using the declarative way? ...

Binding navigation property to RadGrid while using EntityDataSource control

I'm new to Entity Framework and I got stuck in an issue while trying to bind a navigation property (foreign key reference) to a dropdownlist. I have Telerik RadGrid control which gets the data using a EntityDataSource control. Here is the model description: Applications: AppId, AppName, ServerId Servers: ServerId, ServerName The Appli...

Sorting an asp:ListView bound to an EntityDataSource

I have an asp:ListView control on an ASP.NET page. It is bound to an EntityDataSource which is setup this way: <asp:EntityDataSource ID="EntityDataSourceOrders" runat="server" ConnectionString="name=EntitiesContext" DefaultContainerName="EntitiesContext" EntitySetName="SOrder" Include="Address" EnableD...

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

On an ASP.NET web page I have an EntityDataSource: <asp:EntityDataSource ID="EntityDataSourceOrders" runat="server" ConnectionString="name=EntitiesContext" DefaultContainerName="EntitiesContext" EntitySetName="Order" Select="it.OrderID,it.OrderCode,it.OrderDateTime" Where="it.OrderDateTime &gt;...

EntityDataSource: TotalRowCount returns -1. What's that?

I have an EntityDataSource with OnSelected event (fired after finished query). The event handler has event args of type EntityDataSourceSelectedEventArgs e. Query runs fine without error and the IEnumerable e.Results contains 1 object (I can run through a non-empty foreach-loop) but e.TotalRowCount returns -1. Does somebody have an idea...

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

I have a FormView with paging enabled. The FormView is bound to an EntityDataSource ... <asp:EntityDataSource ID="MyEntityDataSource" runat="server" ConnectionString="name=MyEntitiesContext" DefaultContainerName="MyEntitiesContext" EntitySetName="Order" // ... more stuff to define a query </asp:EntityDataSource> ...

Databinding exception with entity navigation property

I have two Entity classes: Order and OrderItem. Order contains a navigation property OrderItemSet of type System.Data.Objects.DataClasses.EntityCollection<OrderItem> On an aspx page is a FormView bound to this EntityDataSource: <asp:EntityDataSource ID="EntityDataSourceOrder" runat="server" ConnectionString="name=EntitiesContext...

ASP.NET EnqityDataSource WhereParameters, creates new property.

I am trying to populate GridView, using EntityDataSource(code behind), I need to able to sort GridView. However when I sort i get error: A property with name 'aspnet_Users.UserId1' does not exist in metadata for entity type So I beleive it is because I generate where parameter in code behind: ActiveEnqDataSource.WhereParameters.Add(new...

Is using an EntityDataSource in keeping with the MVC pattern?

I'm utterly new to APS.NET and in particular the MVC model...! I have a Telerik RadGrid control that I'm using. Until now (following NerdDinner) I was having the Model passed back to the view and this provided access to the various properties I wanted. eg: Inherits="System.Web.Mvc.ViewPage<MySqlMvc.Helpers.PaginatedList<MySqlMvc.Model...

How to implement EntityDataSource Where IN entity sql clause

I want to pass a number of values into a parameter of the EntityDataSource, e.g.: Where="it.ORDER_ID IN {@OrderIdList}" (this is a property on the EntityDataSource) <WhereParameters> <asp:ControlParameter Name="OrderIdList" Type="Int16" ControlID="OrderFilterControl" PropertyName="OrderIdList" /> </WhereParamet...

How to get selected value from GridView (C#)

I have GridView that allows select. It takes data from EntityDataSource. How do I get the entity Object that is selected when the row in GridView is selected ? Primary keys of entities are not displayed in the GridView. Thanks for answers ...

Does the EntityDataSource support "it.Property.Property" syntax?

I have an EntityDataSource where I'm trying to replace some previous code-behind work. My EntityDataSource looks like: <asp:EntityDataSource runat="server" ID="personDataSource" ContextTypeName="Model.GuidesEntities" EntitySetName="CharacterFavorites" OrderBy="it.Person.FullName" ...

Error after Attach() Detach()

I have a RadGrid that uses EntityDataSource bound to Customer table in Northwind. It is the basic auto-everything setup. This code will give the following error after editing the data and clicking Update in the edit form: The object is in a detached state. This operation cannot be performed on an ObjectStateEntry when the obje...

How do I use ENTITY DATASOURCE to Insert Data into a TABLE using OnInserting Event ?

I have two tables: AspnetUsers Userid uniqueidentifier NOT Null PK UserName Nvarchar (256) NOT Null More column More Column UserProfiles UserId uniqueidentifier Not null PK FK Default (newid()) Username Nvarchar(256) Not Null More columns, More More columns There is a constraint between the 2 tables. When a user is insterted...

using entitydatasource in my asp.net page to get value for calendar control, what if NULL value in db?

Hello, I have an asp.net application that is getting its data from sql server. I am using an entitydatasource that gets the data for a detailsview. I templetized the detailsview in the "edit" mode so that I can give the user a asp.net calendar control to select a date. The problem is that when the user clicks on the "edit" button at ...

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 the category name and supplier name. With LINQ to SQL I can have the LinqDataSource control...