MVC

There are 17 entries for the tag MVC
Out with the Old and in with the New (Gradually migrating ASP.NET from VB Web Forms to C# MVC/Razor)

I have a web application that I have been tinkering with for years – about 6 years; it’s built in ASP.NET Web Forms with VB.  Every so often, I jump into this app and create some new features or fix some bugs, and over the past few years I’ve been itching to get it converted over to C# and ASP.NET MVC.  But the application has about 100 screens (distinct views – often a single ASPX will have multiple screens) and there are tens of thousands of lines of Web Forms event-driven code, so I’ve been intimidated by the idea of...

posted @ Tuesday, May 31, 2011 4:07 AM | Feedback (3)

ViewModel Pattern

When I was at BIG, I created what I called the Extended MVP pattern.  I built a framework that was used on multiple projects for managing the presentation layer as well as validation.  I’m still very happy with what I created, and my teams at BIG are still pleased with those applications as well.  In fact, I just learned that they were looking into using the pattern within a Silverlight project they’re doing a proof of concept for.  I mentioned the ViewModel pattern to them, suggesting they use it instead of using the MVP approach.  When asked for more information,...

posted @ Tuesday, October 21, 2008 4:31 PM | Feedback (5)

Custom Controls Everywhere and ASP.NET MVC, part 3

Disclaimer: This article and the ideas presented are based on 7-month-old thoughts that have been undeveloped.  While I expect the ideals disclosed are still valid, they might be totally off-base.  I wanted to finish writing this series and share my thoughts, but I've been unable to keep up with the ASP.NET MVC framework.  Please check here for more information. Another Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.  I am not involved in the ASP.NET MVC project. This article discusses how I think the ASP.NET MVC...

posted @ Saturday, September 20, 2008 6:10 PM | Feedback (2)

Custom Controls Everywhere and ASP.NET MVC, incomplete

I appreciate all of the interest in this article series and I apologize that I've not finished it yet.  I'd like to offer my excuse, although you might not see it as a valid one.  And I'll share my plans for completing the article series. When I started writing this series of articles, I was examining ASP.NET MVC for use on my current project.  I was also about to interview at Microsoft, for what I thought could be a position on the ASP.NET MVC team.  With that combination, it was important that I get pretty familiar with what the team was...

posted @ Sunday, September 7, 2008 1:28 AM | Feedback (0)

Custom Controls Everywhere and ASP.NET MVC, part 2

This is part 2 of a 4-part series discussing a concept that I've long called "Custom Controls Everywhere" and how ASP.NET MVC affects it.  In part 1, we went through a discussion of how ASP.NET MVC took away the capability to use Custom Controls Everywhere.  But in this article, we'll demonstrate a way to resurrect the concept within MVC. Defining Our Sample, Using ASP.NET MVC In order to properly demonstrate how Custom Controls Everywhere can be achieved within MVC, we need to set our baseline.  We're going to use a pretty basic sample: a screen that offers a login form as well...

posted @ Saturday, March 8, 2008 4:25 PM | Feedback (22)

Custom Controls Everywhere and ASP.NET MVC, part 1

This is part 1 of a 4-part series discussing a concept that I've long called "Custom Controls Everywhere" and how ASP.NET MVC affects it.  This article will explain why I advocate the pattern and how ASP.NET MVC takes the capability away. What does Custom Controls Everywhere mean? When I start my explanation of Custom Controls Everywhere, many listeners think I'm off my rocker.  At the least, they think I'm creating a bunch of extra work for nothing.  But once those listeners hear me out, as with some of my other ideas, the critics come to realize the benefits.  I preface the definition...

posted @ Sunday, February 24, 2008 6:05 PM | Feedback (5)

Custom Controls Everywhere and ASP.NET MVC, part 0

As I referenced last night, I've been advocating "custom controls everywhere" for a long, long time.  I don't approve of using the <asp:Textbox> control or <asp:DataGrid> control, or pretty much any others.  Instead, these controls should be inherited, and the derived controls should be used. There are many reasons for doing this, and I've given a few user group talks on this and I've offered tidbits in my blog over the years.  But I've been thinking about how ASP.NET MVC will hinder my ability to use custom controls everywhere, and what I should do about that. The problem is that ASP.NET MVC...

posted @ Wednesday, February 13, 2008 11:53 AM | Feedback (10)

Self-Validating Form Controls

Ever since I started working with ASP.NET, back in v1.0 Beta 1, I've been creating self-validating form controls.  I've gone through a few iterations with them, but overall, the concept has stayed the same. Here's a fun link to an archive of the old Cincinnati .NET user group.  It shows where I gave a presentation back in February of 2003 on this topic.  I was trying to remember when that was, and archive.org was able to remember for me. On my current project, our Textbox got the most attention for validation.  We also...

posted @ Tuesday, February 12, 2008 10:16 PM | Feedback (2)

MVC and MVP Validation

I started a thread on Hanselforum regarding MVC and MVP validation.  Scott responded and I've added another post.  We're discussing where validation should be done in the MVC framework.  Here's what I wrote up as my latest post: It seems like the Model should "own" validation, but for usability, the View must be able to apply it. Ultimately, I think validation needs to be applied at the time of entry as well as at the time of persistence. I don't like self-servicing models (that can persist themselves), and I like being able to validate models in different...

posted @ Tuesday, January 29, 2008 9:32 AM | Feedback (0)

ViewData seems too constraining

I worked more last night on my ASP.NET MVC project.  Second time sitting down to work on it.  I spent the evening dealing with ViewData, trying to find the best way to wrap everything the UI needs into a nice ViewData object.  The night didn't end well. As I mentioned, I'm implementing a wizard.  The user will select one or more products, and then they will be prompted with additional steps for each product selected.  I wanted the View to be able to do something like this: ...

posted @ Thursday, January 24, 2008 10:06 PM | Feedback (1)

Extended MVP Pattern - Article Recap

Over the past few months, I posted several times about my extended MVP Pattern.  Since this was an ill-planned series of posts, I wanted to post a list of the articles involved. Scott Hanselman's post showing off the ASP.NET MVC framework triggered me to finally write about what I had created. Here's the list of my articles though: An Extended MVP Pattern (MVP Validation) MVC/MVP Validation - How's it done? MVC vs. MVP Criticism of my Extended MVP Pattern Response to Criticism...

posted @ Wednesday, January 23, 2008 10:42 PM | Feedback (0)

ASP.NET MVC - First Use

I've been using the ASP.NET MVC extensions tonight; this is the first time I've played with it.  My initial reaction is a bit mixed. The first thing that I got irritated by was that I cannot use any of the ASP.NET validator controls.  I was creating a login form with email address and password, and I wanted to require both of the fields.  With MVC, I can't just slap a validator on and call it a day; I actually have to write the validation logic myself.  Oh, and I can't just use a ValidationSummary control either--I have to render...

posted @ Thursday, January 17, 2008 2:32 AM | Feedback (2)

Response to Criticism of my Extended MVP Pattern

As I posted, I received some criticism about my extended MVP pattern over on ScottGu's blog.  I wanted to submit my response here, and I'll link to this post in a comment on ScottGu's blog. I will venture to guess that the vast majority of the folks that read ScottGu's blog are pretty sharp folks.  And experienced software developers know that there is no sure-fire solution to every problem; there is no single architecture or design pattern that fits every project; there is no silver bullet so to speak.  Microsoft's offering of an MVC framework as well as a...

posted @ Monday, November 19, 2007 10:02 PM | Feedback (3)

Criticism of my Extended MVP Pattern

Over on the ASP.NET MVC (Part 1) thread on ScottGu's blog, there's a little discussion between myself and a couple of others about whether or not a controller should have any logic in it. Doug Ramirez stated: Each 'thing' in the model should include it's own business rules, validation rules, security, and persistance [sic] rules. Doug was stating that Microsoft should publish best practices and guidelines for how to build MVC applications, and he was dictating that controllers should not have any logic--all logic should be housed within your business objects. I...

posted @ Monday, November 19, 2007 5:50 PM | Feedback (0)

MVC vs. MVP

In keeping up with the ASP.NET MVC discussions on ScottGu's blog, Scott made a good point about how ASP.NET will be supporting MVC, not MVP. The above approach I showed uses a MVC based pattern - where the Controller and the View tend to be more separate and more loosly [sic] coupled.  In a MVP pattern you typically drive the UI via interfaces.  This works well with a controls model, and makes a lot of sense with both WinForms and WebForms where you are using a postback model. Both MVC and MVP are...

posted @ Tuesday, November 13, 2007 11:09 PM | Feedback (0)

MVC/MVP Validation - How's it done?

ScottGu posted Part 1 of a series about ASP.NET MVC.  One of the comments asked, "How is input validation going to work?"  That's something that I've been wondering about as well.  With the ASP.NET MVC framework, and others it seems, if the controller has no reference to the view, how does the controller tell the view that the first name field is required?  How does the controller tell the view that the phone number field must be a valid US phone number?  Moreover, how does the controller enforce field-level security, or anything else that would require fine-grained control over the...

posted @ Tuesday, November 13, 2007 12:25 PM | Feedback (0)

An Extended MVP Pattern (MVP Validation)

Until last year, I had never used an MVP/MVC pattern before.  I had read about the patterns at Martin Fowler's site, although the Model View Presenter pattern has since been retired.  I had also seen some posts and demos and talks where people were using MVC/MVP frameworks.  But I kept thinking there was something missing.  I couldn't put my finger on it for a long time, but I just had that gut feeling that something wasn't covered. Last year though, I was assigned to a new project, for the first time in a few years.  The new project was...

posted @ Friday, November 9, 2007 3:43 AM | Feedback (1)