Click here to Skip to main content
15,896,374 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Checkbox in datagrid! Pin
Herman<T>.Instance19-Jan-09 3:34
Herman<T>.Instance19-Jan-09 3:34 
QuestionHow to get a particular sub report of any report programaticaly ? Pin
bhaumikdv15-Jan-09 22:20
bhaumikdv15-Jan-09 22:20 
GeneralMVP implementation questions Pin
Nathan Gloyn15-Jan-09 21:59
Nathan Gloyn15-Jan-09 21:59 
GeneralRe: MVP implementation questions Pin
N a v a n e e t h15-Jan-09 23:04
N a v a n e e t h15-Jan-09 23:04 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn16-Jan-09 4:00
Nathan Gloyn16-Jan-09 4:00 
GeneralRe: MVP implementation questions Pin
N a v a n e e t h16-Jan-09 5:05
N a v a n e e t h16-Jan-09 5:05 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn16-Jan-09 5:38
Nathan Gloyn16-Jan-09 5:38 
GeneralRe: MVP implementation questions Pin
Jon Rista16-Jan-09 5:59
Jon Rista16-Jan-09 5:59 
The general goal behind MVP is to isolate as much logic from the "view" as possible, just like with MVC. The benefits of MVP over MVC are primarily realized when a complete rewrite of an existing WebForms app into an MVC framework can't be done (which sounds like your situation).

I've implemented MVP a couple times for existing ASP.NET WebForms sites, and its been quite successful. In terms of managing state, etc. There are a lot of different kinds of state, and it depends on what state your talking about. ASP.NET WebForms state should probably be keept in the same locations it would have been keept before for basic stuff. If you had a ViewState property on a Page that held a CustomerID, for example, you should probably keep it in the Page ViewState.

As for logic...put as much as humanly possible in the Presenter. The presenter is like the controller from MVC, and one of the main reasons for having it is to allow you to maintain SoC, separation of concerns. A view is just a representation of data, and it really shouldn't contain logic. In the case of WebForms, it will probably need to contain a little bit to handler data set on it by the presenter and render it, but keep it minimal. The presenter should handle all the logic of processing your page, it should contain event handlers to handle events on the view (including events inherited from Page and Control), it should validate input, and decide when to enable/disable controls.

The view should be a standard WebForms .aspx page with codebehind. However, in addition, you will need to create and implement an interface that represents your view. This interface is the access point for the presenter. The proper form of either Passive View or Supervising Controller MVP is that the presenter does not maintain any direct references to the view, only to an interface that represents the view. This allows the presenter to be used for multiple similar views. The view itself should handle the process of creating the presenter, and passing itself to the presenter (thats how the presenter gets a reference to the views interface). This view interface should contain all properties and events on the view, as well as exposing common stuff from the Page class as well, such as the standard page events (OnInit, OnLoad, OnPreRender, etc.)

If you need any more help, I'd be glad to offer it. I have a small MVP framework that I've written that is very lightweight and easy to integrate into existing apps a view at a time, with little configuration. I have considered writing an article about it for a while, maybe the time is right. Most people don't fully realize the benefit of MVP for ASP.NET when you don't have the option of rewriting the whole site as an MVC app (using any MVC framework). MVP is a great way to improve SoC and increase unit testability without requiring a massive rewrite of an existing application.
GeneralRe: MVP implementation questions Pin
Nathan Gloyn16-Jan-09 8:50
Nathan Gloyn16-Jan-09 8:50 
GeneralRe: MVP implementation questions Pin
Jon Rista16-Jan-09 9:21
Jon Rista16-Jan-09 9:21 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn16-Jan-09 9:41
Nathan Gloyn16-Jan-09 9:41 
GeneralRe: MVP implementation questions Pin
Jon Rista16-Jan-09 10:02
Jon Rista16-Jan-09 10:02 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn16-Jan-09 10:17
Nathan Gloyn16-Jan-09 10:17 
GeneralRe: MVP implementation questions Pin
Jon Rista16-Jan-09 10:58
Jon Rista16-Jan-09 10:58 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn19-Jan-09 8:25
Nathan Gloyn19-Jan-09 8:25 
GeneralRe: MVP implementation questions Pin
Jon Rista19-Jan-09 9:55
Jon Rista19-Jan-09 9:55 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn19-Jan-09 10:54
Nathan Gloyn19-Jan-09 10:54 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn3-Feb-09 9:50
Nathan Gloyn3-Feb-09 9:50 
Questionaccess denied for CreateObject("Outlook.Application") Pin
NidhiKanu15-Jan-09 19:41
professionalNidhiKanu15-Jan-09 19:41 
AnswerRe: access denied for CreateObject("Outlook.Application") Pin
Rutvik Dave16-Jan-09 3:49
professionalRutvik Dave16-Jan-09 3:49 
AnswerRe: access denied for CreateObject("Outlook.Application") Pin
Christian Graus25-Jan-09 0:43
protectorChristian Graus25-Jan-09 0:43 
GeneralRe: access denied for CreateObject("Outlook.Application") Pin
NidhiKanu26-Jan-09 18:35
professionalNidhiKanu26-Jan-09 18:35 
Questiongridview rendering from 2 database tables Pin
billcodes15-Jan-09 19:35
billcodes15-Jan-09 19:35 
AnswerRe: gridview rendering from 2 database tables Pin
Abhijit Jana15-Jan-09 20:04
professionalAbhijit Jana15-Jan-09 20:04 
QuestionGridview Pin
kushalrshah15-Jan-09 19:29
kushalrshah15-Jan-09 19:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.