Geeks With Blogs
AzamSharp Some day I will know everything. I hope that day never comes.

I saw Scott Hanselman screencast on ASP.NET MVC Framework. After watching the video I realized that this MVC framework is pretty much like classic ASP or atleast have some similarities. Check out the code below where I have populated a DropDownList (HTML Select Tag):

 <select>
   
    <% foreach (var category in ViewData)
       {  %>
   
    <option id="ddlCategories" value = "<%= category.id %>"> <%=  category.CategoryName %> </option>  
   
    <% } %>
   
    </select>

The controller was responsible for filling the categories and view is responsible for outputting the details. Here is the HomeController which gets the categories:

 [ControllerAction]
        public void Categories()
        {
            NorthwindDataContext dc = new NorthwindDataContext();
            RenderView("Categories", dc.Categories);
        }

 

I agree that by creating our own rendering engine will give us more flexibility and there will be no viewstate on the page hence making the page run faster *but* now we have a tough job of rendering the items manually. I mean the real power of ASP.NET is the ASP.NET controls. If we are trying to move away from the ASP.NET controls we are missing a lot of features. Now, we have to do everything on our own which includes styling the controls and maintaining their state. Plus, in my opinion it would be harder to maintain the application once you have the classic ASP like code floating in the HTML of the page.

What do you think?

Posted on Tuesday, December 11, 2007 5:45 AM | Back to top


Comments on this post: ASP.NET MVC Framework = Classic ASP

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
You're still going to be able to use controls, from what I understand. You just won't be able to use complex controls that would have depended on ViewState to process events, like a GridView.

A lot of MVC examples use a standard <asp:Repeater> control.
Left by Dave on Dec 11, 2007 7:07 AM

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
I have an experience with RubyOnRails platform which has build-in MVC support. I should mention that development is match easier and faster than in ASP.NET.
Left by Evgeny on Dec 11, 2007 7:16 AM

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
It's a matter of choice. Personally I'm fed up trying to coax web controls to render what I want. The code above is giving back control of the *rendering* and leaving all the meaty code in the compiled classes. I think it's the best of both worlds.
Web Forms aren't going away, so they are still an option for those who want to use them
Left by Geoff Stockham on Dec 11, 2007 7:27 AM

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
@Evgency,

I also had the same experience with RubyOnRails. Off course ROR scaffolding capabilities were awesome. I think what we need is some sort of a framework which can create simple & complex pages without us having to create the UI. Kind of like a PageBuilder.
Left by Mohammad Azam on Dec 11, 2007 8:08 AM

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
@Geoff Stockham,

You are right! It is a matter of choice. At present moment I still prefer the Web Forms method for development ASP.NET pages.
Left by Mohammad Azam on Dec 11, 2007 8:10 AM

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
What's stopping anybody for writing controls for the MVC? It might take some time to catch up, but it's going to happen. You're not going to write a lot of repetitive code without somebody writing reusable view components for this.

Besides, you can still use ASPX pages for the view, right?
Left by Jeremy on Dec 11, 2007 10:27 AM

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
Hi Jeremy,

Thanks for the comments!

I know that Rob Conery wrote few helper classes that will create HTML controls. That was pretty awesome!

Looking forward to see some cool MVC controls!



Left by Mohammad Azam on Dec 11, 2007 10:37 AM

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
Yeah, it's going to take time for us to catch up on regular ASP.NET in terms of controls. After all, they have a how many year head start?
Left by Haacked on Dec 12, 2007 8:33 PM

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
BTW, Don't you think the title of your post is a bit harsh? :(

Classic ASP!!! Ouch! You hurt my feelings. Unless you knew some great way to build an MVC framework on classic ASP I didn't know about.

Remember, the inline code was not the problem in classic ASP. The problem was there was no really good way to separate biz logic and view logic (there were schemes that attempted to do this pretty well, but still). Developers were even encouraged to mix biz logic with view logic.

This is a lot different I think.
Left by Haacked on Dec 12, 2007 8:40 PM

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
@Haacked,

Not meant to hurt your feelings man! You are one of my favorite bloggers. You made some valid points and I think with the passage of time we will see more cool MVC controls that will allow us to render controlled HTML.

I guess I was thrown by the idea of running a foreach loop to generate the HTML table.

A little off-topic but another suggestion is to make the controls AJAXIFY. I know we have a MS ASP.NET AJAX but I think that is pretty slow as the complete Page Life Cycle is executed. If we have some controls HTML controls that have the AJAX power and will be a part of the MVC framework then I think it will be very cool!


Left by Mohammad Azam on Dec 13, 2007 5:23 AM

# re: ASP.NET MVC Framework = Classic ASP
Requesting Gravatar...
ASP.NET MVC != Classic ASP

Using MVC will provide a separation of concerns that any large project requires. If done correctly, just this feature alone is worth it. Separating concerns provides real maintainable sections of code versus the alternative of sticking everything in to single code files and such. Sure in traditional view state pages we can do all sorts of break outs, but this is one of the first clean break outs.

The second biggest thing, if not the biggest reason to use this, is the facet of TDD. TDD is a life saver for the industry. If one doesn't use it, they need to learn how to or they will be weeded from the ranks of real developers as their abilities fade into mediocrity.

TDD == Rockinz!
Left by Adron on Jan 11, 2008 11:46 AM

Your comment:
 (will show your gravatar)


Copyright © Mohammad Azam | Powered by: GeeksWithBlogs.net