Is Using An EntityDataSource In Keeping With The MVC Pattern

Apr 23, 2010

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.Models.Customer>>

.. lets me loop around the Model object and extract Customer data. This RadGrid control, however, needs me to use an EntityDataSource (hooked up via the designer). Does this have implications for maintaing the MVC pattern? I'm a little confused about how the EntityDataSource works in relation to my Model.EDIT: I do know there is an MVC version of the RadGrid but we also need the RadScheduler and a few others.. besides that, I'd still like to know the impact.

View 1 Replies


Similar Messages:

Pattern For Retrieving Complex Object Graphs With Repository Pattern With Entity Framework

Oct 13, 2010

We have an ASP.NET MVC site that uses Entity Framework abstractions with Repository and UnitOfWork patterns. What I'm wondering is how others have implemented navigation of complex object graphs with these patterns. Let me give an example from one of our controllers:

[code]....

It's a registration process and pretty much everything hangs off the POCO class Person. In this case we're caching the person through the registration process. I've now started implementing the latter part of the registration process which requires access to data deeper in the object graph. Specifically DPA data which hangs off Legal inside Country.

The code above is just mapping out the model information into a simpler format for the ViewModel. My question is do you consider this fairly deep navigation of the graph good practice or would you abstract out the retrieval of the objects further down the graph into repositories?

View 2 Replies

MVC :: AsyncController Gripes / Working Pattern For Converting A GET-POST-GET Pattern To Asny?

Feb 23, 2010

Does anyone have a working pattern for converting a GET-POST-GET pattern to asny?

I'm encountering the following issues:

1. You cannot mix Sync and Async action methods SubmitForm(), SubmitFormAsync(bool? confirm), SubmitFormCompleted() ... (because the resolver gets all confused ... it doesn't use the HTTP verb to decide who to target. BTW: I think that's poor design, or a bug)

2. Renaming the get method name to something else eg: SubmitFormConfirmation(), SubmitFormAsync(bool? confirm), SubmitFormCompleted() would be very awkward if it works ... because you have to doctor the <form markup to specify an action name.

3. You cannot give them all async names SubmitFormAsync(), SubmitFormAsync(bool? confirm), submitFormCompleted(), because the call just keeps malfunctioning. It sometime even behaves as if you are requesting a delete of something.

Can someone give an insight from an actually working sample.

View 5 Replies

Best Design Pattern For Associating Subdomain With Area And PRG Pattern?

Aug 21, 2010

Now that the next version of ASP.NET MVC is being prototyped and previewed (ASP.NET MVC 3 Preview 1 came out a couple of weeks ago), I wonder if we should call the attention of the Core Dev team (S Hanselman, Phil Haack and all) to this "feature."there a easy/non tacky way of associating subdomains &#8594; areas?Something like:
[URL]Also, whats the best accepted design pattern in implementing PRG pattern in ASP.NET MVC? I guess it should also get some official loving in MVC 3.

View 2 Replies

Configure EntityDataSource From A DAL?

Mar 25, 2011


I have a simple ASP.NET (Web Form) application. I created a separate project for my DAL. In the DAL, I have created an entity called Sites.

Now, I want to bind that to a form using an EntityDataSource control but it isn't visible. What am I doing wrong?

I made sure to reference the DAL.dll in the web project and include it in the code behind for the form. It's been a while since I've been in ASP.Net :-)

View 1 Replies

Refresh DropDownList From EntityDataSource?

Mar 18, 2011

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 mentioning this is inside a ModalPopupExtender which is inside an UpdatePanel. Maybe there is a way in just putting all the data in the second DropDownList and filter it depending on the value of the first one... or something like that... so there's no need of refreshing the data.

<asp:DropDownList ID="PaqueteKitDropDownList" runat="server" DataSourceID="PaqueteEntityDataSource"
DataTextField="Nombre" DataValueField="ID_Paquete" />
<asp:EntityDataSource ID="PaqueteEntityDataSource" runat="server" ConnectionString="name=CCEntities"
DefaultContainerName="CCEntities" EnableFlattening="False" EntitySetName="Paquetes">
</asp:EntityDataSource>
<br />
<asp:Label ID="Label66" AssociatedControlID="PlanKitDropDownList" runat="server"
Text="Plan:" />
<asp:DropDownList ID="PlanKitDropDownList" runat="server" DataSourceID="PlanKitEntityDataSource"
DataTextField="Duracion" DataValueField="Costo" />
<asp:EntityDataSource ID="PlanKitEntityDataSource" runat="server" ConnectionString="name=CCEntities"
DefaultContainerName="CCEntities" EnableFlattening="False" EntitySetName="Duracion_Plan"
Where="it.ID_Paquete == @ID" OrderBy="it.Duracion ASC">
<WhereParameters>
<asp:ControlParameter DbType="Guid" Name="ID" ControlID="PaqueteKitDropDownList"
PropertyName="SelectedValue" />
</WhereParameters>
</asp:EntityDataSource>

View 2 Replies

ADO.NET :: Is It Possible To Use OFTYPE In Where Clause Of An Entitydatasource

Nov 30, 2010

is it possible to use OFTYPE in where clause of an entitydatasource? I mean something like this:

srcUsers.Where = "OFTYPE(Doctor)";

View 1 Replies

C# - How To Filter Data Using EntityDataSource

Mar 28, 2011

I use EF 4, C# and MS Membership Provider.

I have a GridView with DataSource an EntityDataSource web control.

I would like filter Data using EntityDataSource, filter show apply for the Current Logged-In User, this value should be taken using MS Memebership Provider ( Membership.GetUser(); ).

Now I cannot inf any Parameter in EntityDataSource that would allow me to dot that (in Where/Automatically generate a Where expression using provided parameter ).

View 1 Replies

C# - How To Populate A TreeView Using EntityDataSource

Jan 5, 2011

I use MS SQL, EF 4 and C#.

I have a table in SQL fro "Categories" and I need populate a TreeView in my Asp.net page.

My question are:

1 - How can i populate the TreeView?
2 - How can i use the TreeView to modify the hierarchy of my Categories?

NOTE: I use "hierarchyid" SQL Columns!

CREATE TABLE dbo.CmsCategories
(
CategoryId int NOT NULL IDENTITY (0,1) -- Seed = 0 and Increment= 1
CONSTRAINT PK_CmsCategories_CategoryId PRIMARY KEY,
Title nvarchar(40) NOT NULL,
MetaDescription nvarchar(160) NOT NULL,
MetaKeyword nvarchar(128) NOT NULL,
Summary nvarchar(256) NOT NULL,
IsPublished bit NOT NULL
CONSTRAINT DF_CmsCategories_IsPublished DEFAULT 1,
CategoryNode hierarchyid NOT NULL,
CategoryNodeLevel AS CategoryNode.GetLevel()
);

View 1 Replies

C# - Set A Parameter For WhereParameters In EntityDataSource?

Dec 29, 2010

I have an EntityDataSource and I need set WHERE to a Local Variable Type: GUID.

My problem is I am not able to send my local variable Guid to EntityDataSource for a WHERE OPERATION.

I also tried to to use a ControlParameter<asp:ControlParameter Name="UserId" /> and have a Label with Text property on my Guid converted in String. But does not work.

<asp:EntityDataSource ID="EntityDataSourceListAuthors" runat="server"
AutoGenerateWhereClause="True"
ConnectionString="name=CmsConnectionStringEntityDataModel"
DefaultContainerName="CmsConnectionStringEntityDataModel"
EnableFlattening="False" EntitySetName="CmsAuthors" Where=""
EntityTypeFilter="" Select="">
<WhereParameters>
<asp:Parameter Name="UserId" />
</WhereParameters>
</asp:EntityDataSource>

View 1 Replies

Get To The Next Level Of Assocation In An EF4 EntityDataSource?

Mar 3, 2011

I've used EF4 EntityDataSources to do DataBinding with success, but here's a case where I'm stumped:

Table "CurrentComplaintsByUsers" has a foreign key over to a "Complaints" table. So in EF, I can access a CurrentComplaintByUser record, and navigate to its parent complaint like so:

var ccU = dataContext.CurrentComplaintsByUsers.First();
var parentComplaint = ccU.Complaint;

When I whip up an EntityDataSource based on CurrentComplaintsByUsers to bind a gridview, I want to get over from the "Complaint" object to an Assocation of Complaint called "Status". Here's a StatusID in my Complaint table, and so in code I can hit a complaint's status like so, including the Status properties:

string statusLabel = parentComplaint.Status.LabelText;

FAILURE: when I try to bake this all into an EntityDataSource, I can't get from my starting item "CurrentComplaintsByUsers" over to "Status". Here's my EDS:

<asp:EntityDataSource ID="edsCurrentCases" runat="server"
ConnectionString="name=EOCaseDataModel" DefaultContainerName="EOCaseDataModel"
EnableFlattening="False" EntitySetName="CurrentComplaintsByUsers"
Include="Complaint, Status">
</asp:EntityDataSource>

My error is this:

System.InvalidOperationException
"A specified Include path is not valid.
The EntityType 'EOCaseApp.CurrentComplaintsByUser' does not declare a navigation property with the name 'Status'."

I'm trying to get to the point where this works in my Gridview:

<%# ((CurrentComplaintsByUser)Container.DataItem).Complaint.Status.LabelText %>

So, using declaritive markup only, how do I get to a related objects associations from the EDS? (I can do it in code, just trying to use the EDS exclusively when I can)

Other notes: if I remove "Status" from the "Include" in the EDS, then I get a NULL ERROR when it hits ..Complaint.Status.LabelText in my Gridview, pretty much what you'd expect.

View 1 Replies

ADO.NET :: EntityDataSource With Custom Column?

Aug 5, 2010

I try to do exactly like this thread : http://forums.asp.net/p/1551018/3802862.aspx#3802862But when i apply the solution it do work but i can't delete an entry anymore in the GridView..

View 4 Replies

ADO.NET :: Use Linking Table In An EntityDataSource?

Nov 17, 2010

I have an A B AB (Many-to-Many?) table setup (where AB is the Linking Table for records in A and B by their IDs). Entity Framework 4.0 seems to create the EDM correctly (making an entity for A and B, and navigation property for AB). My problem is getting a GridView bound to an EntityDataSource to display columns from A with associated B records.

Here's my code:

[Code]....

The resulting GridView only shows columns from A. How do I get it to also show the associated columns from B? Do I have to explicitly define the columns or is AutoGenerateColumns smart enough to figure it out?

View 2 Replies

C# - EntityDataSource - Where Clause From Different Table?

Nov 22, 2010

I am using EF 4 and EntityDataSource in a Page (WebForms).

This page contains a DropDownList that display UserName.
Data from this DropDownList it is from "aspnet_Users".
At the moment I am using a single EntityDataSource code belove:
<asp:EntityDataSource ID="EntityDataSourceListUsers" runat="server" ConnectionString="name=CmsConnectionStringEntityDataModel"
DefaultContainerName="CmsConnectionStringEntityDataModel" EnableFlattening="False"
EntitySetName="aspnet_Users" Select="it.[UserId], it.[UserName]">
</asp:EntityDataSource>

I need to FILTER the UserName associated to a specific ROLE and displaying it in the DropDownList therefore using others tables"aspnet_UsersInRoles" and "aspnet_Roles".

How to do it?
Would be great have a simple solution since I am a beginner.

View 1 Replies

ADO.NET :: EntityDataSource And Integer Default Value?

Feb 5, 2011

i'm using an entitydatasource to save an entity which has an nullable integer property with the default value 0,this property is bound to a textbox in a formview.I assume that when I leave the textbox blank the datasource should understand that I want the property to have null and set it to 0 by default, but it acts different way, it doesn't save the enity at all and gives the entity in Updated and Inserted events as null:

[Code]....

View 3 Replies

ADO.NET :: EntityDataSource Inserting In Code Behind?

Nov 9, 2010

I have a Entity Data Model with a number of tables in it. I have a web page that only has an EntityDataSource on it.In the code behind I am collecting some data that I am going to write to a SQL table What I want to do is call the EntityDataSource_Insert event and when it is fired it will call the EntityDataSource_Inserting event.

[Code]...

View 9 Replies

EntityDataSource Replace * With % Wildcard On Queries?

Jan 8, 2011

I have an application that uses EntityDataSource in many places. In the EDS, I manually build the Where clause based on user input from TextBox'es.

I would like the user to be able to enter "*" (asterisks) instead of "%" when querying data.

Is there an easy as using Entity SQL or the EDS itself to do a search/replace? I know I could actually change the TextBox after the data is entered, but when the user sees his text was changed from an * to a % I don't think he will understand.

I have tried using the T-SQL Replace command and doing something like this:

<asp:EntityDataSource ID="EDSParts" runat="server"
ConnectionString="name=TTEntities" DefaultContainerName="TTEntities"
EnableFlattening="False" EntitySetName="Parts"[code]....

But I get a "Server tag is not well formed" message. I can't find an equivalent "replace" function in the Entity SQL reference....

View 2 Replies

C# - Populating GridView Using EntityDataSource And QueryString?

Mar 23, 2011

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 to Page2.aspx. In Page2 I am having EntityDataSource and GridView. Also, the value needs to be populated is from different tables in this page. How you deal with this in EntityDataSource and populating it in GridView?

View 3 Replies

DataSource Controls :: LinqDataSource And EntityDataSource?

Jun 12, 2010

I'v been using SqlDataSource and ObjectDataSource for a while.I would like to know about LinqDataSource and EntityDataSource. Therefore I have 2 questions to ask.1) Why do we need to use those twos? 2) In which cirmustances (Requirements) developers are using LinqDataSource and EntityDataSource?

View 1 Replies

ADO.NET :: Set Entitydatasource Select Method To A Function?

Oct 3, 2010

how to set entitydatasource select method to a function?

could i use objectdatasource with entity model?

View 1 Replies

C# - Retrieve A Data In A Variable From EntityDataSource?

Nov 24, 2010

I use C#, asp.net 4, EF4,

I have a page with a DetailsView control is connected with EntityDataSource. All is working.

In code behind I need to create a variable that will populate with data from EntityDataSource, lets imagine field UserId.

My questions: How to retrieve and use data from EntityDataSource?

View 1 Replies

C# - Filter EntityDataSource For DateTime Field?

Aug 31, 2010

I am using and EntityDateSource and I add where condition to filter the data at runtime and then bind the grid to the dataSource, but I am getting following error:-

The argument types 'Edm.DateTime' and 'Edm.String' are incompatible for this operation.

Search condition looks like this:-

it.[MyDate]='8/13/2010 00:00:00'

View 2 Replies

AJAX :: Using A Div Tag For That Keeping An Scroll Bar?

Feb 7, 2010

i am using an div tag for that i am keeping an scroll bar. which is an slider control. now here i need to replace the vertical line image with my own image . and the scroll image to. so it possiable to achive this in the slider control what we are using

View 1 Replies

C# - Keeping Basket More Permanent?

Feb 22, 2011

I need to keep my basket more permanent I have two options and I want to choose the best one.

I have eCommerce web site application in asp.net and there is a basket include products which are selected by users before, so options:

1- keep basket in database (consider the cost and time to store and retrieve information)
2- store my basket in Cookies (I don't know what the implementation is)

I couldn't use session because it is not permanent and clear by closing browser.

My goal is : when the user close the IE for 1 day or 2 days make ability to remember all products that already added to basket.

In addition, my basket is store in hash-table now, for example : {1:4055,2:4588,...} they are ID and product code(keys). they are all save in a hash table.

View 1 Replies

Keeping Connection Or Reconnecting To Sql?

Feb 16, 2010

I am trying to make a program that queries the same tables every few seconds.Is it better to use the same connection to reconnect everytime before the program requeries ?

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved