Mvp Pattern. Move Data From View Into Presenter?
Aug 16, 2010
I am using mvp pattern in small project. I have problems with view which contains html table with data(always 9 rows). How can i easily get data from html table and send it to the presenter? On the model side i want to keep data from html table as a generic List<some_type>
View 1 Replies
Similar Messages:
Apr 5, 2010
I have a ASP.NET Web Forms application and I'm using some dynamic controls in the view which depend on stuff that the presenter exposes. Is it okay for the view in this case to pull on the presenter for that data? Is there anything I should be extra careful about when considering testability and a loosely coupled design.
The page in this case has it's own page-life cycle and the presenter doesn't know about this. However, the page-life cycle dictates that somethings must occur at specific moments in the page-life cycle. This smells like trouble... Any known pit falls?
EDIT
When my concrete view hits the Init event it will pull on the presenter for a collection that will result in a bunch of ASP.NET server controls to be created. I'm wondering if this is a particular bad thing to do... The presenter doesn't know how to respond to the page-life cycle init event but it has to if the view is to be populated with dynamic controls.
View 2 Replies
May 12, 2010
I would like to use MVP pattern and add a presenter layer in my web app. EX;- for filling the data in page I am doing like this.
[Code]....
If I add a presenter class, Do I need to move this code in presenter layer?
View 2 Replies
Jun 11, 2010
What is the best way to get a number of property values of a business object from the View to the Presenter in a WebFormsMvp page?
Bearing in mind this issue with DataSources: [URL]
Here is what i propose:
The scenario is, I have a business object called Quote which i would like to load form the database, edit and then save. The Quote class has heaps of properties on it. The form is concerned with about 20 of these properties. I have existing methods to load/save a Quote object to/from the database. I now need to wire this all together.
So, in the View_Load handler on my presenter i intend to do something like this:
[code]....
View 1 Replies
Jan 26, 2010
In Model-View-Presenter what is the correct pattern to do a page that:
a) contains a grid for browsing a list of items
b) an alternate mode for editing single items .maybe you are toggling between two asp:panels.
Do you just make the presenter smart enough to do two types of presentations?
Make 2 presenters?
I'm new to this pattern and want to do it correctly. I understand how I would do this functionality on two pages. Just not sure what is the accepted practice when the browse and detail exist on the same page.
View 1 Replies
Jul 23, 2010
I'm using Model-View-Presenter framework. When Loading a page, I'm having trouble setting the selected item that came from the Database.
In view, I know I need:
protected void ddlStatus_SelectedIndexChanged(object sender, EventArgs e)
{
presenter.DdlStatusSelectedIndexChanged();
// what should this pass?
}
Then in Presenter:
public void DdlStatusSelectedIndexChanged()
{
view.DdlStatus = ???
// Should I pass the SelectedIndex?
}
I also think that part of my problem is that DdlStatus I have as a List.
Interface:
List<StatusDTO> DdlStatus { set; get; }
The best I found is here (but needs formatted!) ---> [URL]
View 2 Replies
Jun 2, 2010
I have been reading about different model for development
model view control mvc
model view presenter MVP
Model view view model MVVM
i belive MVC has two big Advantage over webform 1) TDD 2) More control on HTML
MVP is bit variation in mvc model. rapid development as well as 1) TDD 2) More control on HTML (correct me if i m wrong) see the below link
[URL]
View 7 Replies
Mar 26, 2010
I have grivd view and im getting the data source from stored proc using DataTable.
I also put extra coloum button in gridview, however that extra button is located in first coloum.
how to move the that button to last coloum?
This is some of my code
/* .aspx */
<asp:GridView ID="gridview1"
runat="server"
AutoGenerateColumns="true"
OnRowCommand="gridview1_rowCommand"
>
<Columns>
<asp:ButtonField ButtonType="Button" CommandName="Greeting" Text="HelloWorld"
HeaderText="Action" />
</Columns>
</asp:GridView>
/* .aspx.cs */
DataTable FaultsSummary = _WelcomeXn.Greeting(ID);
gridview1.DataSource = FaultsSummary;
gridview1.DataBind();
View 5 Replies
Jan 28, 2011
[Code]....
i want to get data from database of field Name and Gender, and then display it in Label name and gender. when i click save it move to next record and display name and gender that next record.
View 3 Replies
Jan 19, 2010
When I first heard about ASP.NET MVC, I was thinking that would mean applications with three parts: model, view, and controller.
Then I read NerdDinner and learned the ways of repositories and view-models. Next, I read this tutorial and soon became sold on the virtues of a service layer. Finally, I read the Fluent Validation documentation, and I'll be darned if I didn't end up writing a bunch of validators.
Tonight, I took a step back and thought about what had become of my project. It seems to have become the victim of the design pattern equivalent of "feature creep". Somehow I'd gone from Model-View-Controller to Model-Repository-Service-Validator-View-ViewModel-Controller. You want loosely coupled and DRY? We got your loosely coupled and DRY right here! But I'm wondering if this could be a case of too much of a good thing.
Am I right to be concerned? Or is this actually not as crazy as it sounds? On one hand, it seems crazy to have so many layers. On the other hand, every layer has a clearly defined purpose that makes sense to me. Have your MVC applications turned into MRSVVVMC apps too? If not, what do they look like? Where's that right balance?
View 2 Replies
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
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
Apr 15, 2010
I want to create jump button to go to the x number of the next record in the form viewWhat is the command in the csharp?
View 2 Replies
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 → 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
May 15, 2010
In VS 2005 I could change the layout appropriately, to move controls in a web form in design mode, to a place where I intend to. But in VS 2008 , I don't see such an option. My controls are stuck in places of their own and I am unable to move them to the intended locations. Googling suggested to use Tools -> option -> HTMLDesigner -> CSS. But not sure that is the correct route.
View 1 Replies
Sep 9, 2010
We have an already existing project on IIS and we want to move to Apache (windows) with mod_aspdotnet. What things could not work? If we use 3rd party DLLs? Will office components work fine (export to Excel, Word, etc). If you have any experience on this type of migration, I'd like your inputs! Also, is there another alternative to mod_aspdotnet?
View 1 Replies
Apr 4, 2011
I'm new to using the MVP pattern and I just want to make sure on the best way to call a presenter from within a user control.
MyPage.aspx has a presenter MyPresenter
The page contains a user control which accepts MyPage's Presenter via a property which I setup from MyPage
MyUserControl.Presenter = this.Presenter
I'm now trying to call Method1 within the presenter which retrieves some config and sets it on the view from the user control.
Presenter.Method1(); // calls method and sets config to the view
My question is firstly
should I be using the presenter in the user control in this way?
If so, is it valid to be accessing the view value via the user control as shown below.
Presenter.View.MyData
I just want to make sure I'm not going off down the completely wrong path with this!
View 1 Replies
Jan 27, 2010
I recently read Phil Haack's post where he gives an example of implementing Model View Presenter for ASP.NET. One of the code snippets shows how the code for the view class.
public partial class _Default : System.Web.UI.Page, IPostEditView
{
PostEditController controller;
public _Default()
{
this.controller = new PostEditController(this, new BlogDataService());
}
}
However, here the view constructs the instance of the BlogDataService and passes it along to the presenter. Ideally the view should not know about BlogDataService or any of the presenter's lower layer dependencies. But i also prefer to keep the BlogDataService as a constructor injected dependency of the presenter as it makes the dependencies of the presenter explicit.
This same question has been asked on stackoverflow here.
One of the answers suggests using a service locator to get the instance of the BlogDataService and passing it along to the presenter's constructor.This solution however does not solve the problem of the view knowing about the BlogDataService and needing to explicitly get a reference to it.
Is there a way to automatically construct the presenter object using an IoC or DI container tool such that the view does not have to deal with explicitly creating the BlogDataService object and also injecting the view and service instances into the presenter's constructor. I prefer to use the constructor injection pattern as far as possible.
Or is there a better design available to solve the problem?. Can there be a better way to implement this If i am building a WinForms application instead of a ASP.NET WebForms application?
View 2 Replies
Dec 21, 2010
I am currently using the 3-tier Repository pattern in my application. Actually it's the first time for me to implement a design pattern at all! i used to put all my code in the so called now presentation layer.
i want to implement data validation, for example, password should not be more than 10 characters and have to contain special characters. Should i put this code in the data access layer? but my data access layer contains methods that take the DTO as a parameter for example
[Code]....
and the same is for other CRUD operations (DELETE and UPDATE), so implementing such validation on the DAL would make me duplicate the code in each and every method that accepts the DataObject as a paramter. Same holds for the business logic layer where i am using it as a proxy between the presentation and the data access layers.
Eventually it has to use the same Data Objects as parameters. This only leaves me with one option which is to do the validation on the Data Object part. But i think this is not the essence of the respository pattern which states that the Data object class should only be a "container" class with no behavior.
View 1 Replies
May 26, 2010
I'm fairly new to ASP.Net MVC 2 and understand the MVC pattern in itself. But my question is what's the best way to populate dropdownlists in the UI sticking to the MVC pattern. Should I be going through the controller? Every article I've seen to do this shows how to do it using javascript and jquery. I have a test application that I'm re-writing in MVC2 I have my dropdowns working with jquery basically calling a WCF Data Service that returns JSON which populates the dropdowns. Seems to me though that this is bypassing the controller and going straight to the model therefore strictly violating the MVC pattern. Or am I missing something obvious here. You thoughts or best practices would be greatly welcome here.
View 3 Replies
Jul 19, 2010
In my asp.net website I need to return data obtained from DB by adding html tags to it from a server side method,just like a webmethod returns jsonified data. I am having trouble understanding if a webmethod can serve the purpose(i.e., htmlifying the data).If not how do I acheive it?
View 1 Replies
Jul 28, 2010
the best practice for a designing a simple CRUD application with some screens updating various tables (like admin pages to maintain static data for an application). the simplest way would be to drag a data grid/gridview, bind it to a dataset and use a data adapter for CRUD operations. but if this application needs to be scalable, lets say to add any extra UI/business logic in future, then is there any design pattern that can with this? should I be using an object data source control and bind it to business objects instead? or are there any better ways of doing it? should I build a complete layered application or will that be overengineering for this requirement?
View 3 Replies
Jan 2, 2010
I am seeing things that lead me to believe that using data aware controls is almost the opposite of what VC tries to do? But how can I recoupe the advantages of a data aware control and cooperate with the MVC Model?
View 2 Replies
Apr 18, 2010
design pattern that works well with Visual Studio data tools against an MS SQL server; to retrieve a subset of an object's fields for all rows, and then on-demand retrieve the remainder for one row. I.E. just the small summary fields that I will serialize to a master grid view, then the larger properties including a large blob that I will render in a detail view. The performance hit from retrieving the large blob with the master result list would be too great.
The data shape is static, and I can define two separate data classes to match the specific summary vs. detail information returned. However that sounds anti-pattern-ish, to define the data classes specifically to suit the presentation layer. It also presents another problem, how to translate from the summary item to the detail item in an object-oriented way?
View 9 Replies
May 20, 2010
i have a gridview and i use item templete to print data from database, I use #Eval() to do that, how i can use #Eval() to print tow rows?
example:
<asp:GridView runat="server" AutoGenerateColumns="false" GridLines="None">
<Columns>
<asp:TemplateField>
<ItemTemplate>
[Code]....
how i can move next??? i need to do that programmatically because i will use JQuery and i need to print two times in two divs
View 4 Replies