Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

The HTML Theme: Please don’t let me be misunderstood

Presented last week at the Calgary .NET User Group and the Edmonton .NET User Group. Both went swimmingly in this hillbilly’s view and I had a fantastic time doing both. At some point, I’m going to have to admit to myself that I probably do this for my benefit more than the attendees. But as long as both our interests align, I’ll keep telling myself I do it to help the community.

As a bonus, I get this nice shiny blog post out of it. Because the same question came up at both meetings and I didn’t give it its due either time. The question was, and I’m paraphrasing:

I’m diggin’ the new framework and all and your love of plaid is refreshing, but I’m a WebForms guy. This new-fangled way of putting these "INPUT" controls on a page is strange and unfamiliar, but not in a good way. You’re asking me to abandon all I know of web development. My asp:ListBox? My asp:DropDownList?!? FOR THE LOVE OF ALL THAT IS HILLBILLY, DON’T MAKE ME GIVE UP MY PRECIOUS GRIDVIEW!!

The response I gave to this question in Edmonton was: We’re web developers. Learn HTML.

I was about to say that this probably sounds more condescending than I meant it to be but I don’t think that’s true. Subconsciously, that’s kind of what I think whenever I’m asked. Usually I sugarcoat it but I’m testing the waters into beligerence these days to see where it takes me. So far, I don’t think I have the stomach for it but I’ll give it a couple more weeks.

Anyway, as much as Microsoft has gone to great lengths to protect us from the scary world of HTML, let’s not forget that the web is still very much powered by it. It behooves us to learn it (and I’m not using the Webster definition of "behooves", not the one I learned from my sister-cousin).

Here’s the thing: HTML is not hard. Javascript is not hard. HTTP is not hard. Statelessness is not hard. In general, WebForms is an abstraction over a problem that is not hard. Especially now that we have some pretty mature Javascript libraries, like jQuery and Prototype. And certainly now that pretty much any problem you might encounter related to managing statelessness has already been solved several times over.

Web applications have become pretty sophisticated over the years such that users are starting to demand more for their "money". It is my experience that the demands they are making do not play nice with server-side controls. WebForms was a nice model back when it was acceptable to perform a full-on postback every time you wanted to go to the next page in a grid.

But this is 2008. And I’d like to be able to bookmark that page now and e-mail the link to someone else. I’d like the ability to click the Back button and not get a Page Expired error. I’d like to sort a list of items and not have it add to my browser history.

You can do all this in WebForms, of course. But usually, people say it like this: "Well, that’s possible in WebForms…." Not "Dude, that’s a freakin’ BREEZE in WebForms. It was designed with that specific scenario in mind."

So yes, if you’re interested in MVC, you’ll need to know a bit about HTML. You’ll need to manage any "state" yourself. You’ll need to understand what happens when a form is submitted via POST vs. GET. You’ll need to account for things like validation during a form submittal.

But don’t shy away from it. Give it a try, it’s not hard. The <INPUT> tag has its flaws but it’s pretty simple to figure out. Maybe take a Javascript library out for a spin. You might even find that it’s fun.

Or at the very least, that it’s never been easier to add rounded corners to a DIV.

Kyle the Web-Formed

PS. Code from the presentation will be forthcoming.

This entry was posted in ASP.NET MVC, Presenting. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Jason

    I believe the problem is how developers are using webforms. some think asp.net is a programming language (not a framework), others think the code behind is a cure all for any business process. By taking away webforms, you are taking away their “language” of choice. This is why they either don’t understand, or shy away from MVC.

    and for web developers (myself included) who started with webforms our html skills are lacking from the start.

    adapting to ms mvc doesn’t mean losing webforms all together. webforms is the default templating engine. you can still use server controls to render the html (within the asp:form tags). you only loose postbacks (and viewstate should be disable, no need for it without postbacks).

  • http://panteravb.com Chris

    Awesome post!

    It’s amazing how many ASP.NET “Web Developers” don’t know anything ,or very little anyway, about html and javascript.

  • http://www.dualbotic.com/dasBlog Charlie Barker

    For anyone who did a decent amount of classic ASP development before switching to .net webforms, MVC will be like a breath of fresh air.
    Everyone knows Microsoft created webforms to make it easier for winforms developers to “do web development”
    The problem they have failed to come up with a solution for (as far as i know) is the 3rd party controls issue. 3rd party control developers need a way to plug their controls into the MVC framework. Without this small in-house dev teams that rely heavily on these controls will have to stick with webforms.

  • http://blog.jagregory.com James Gregory

    Hallelujah!

  • Łukasz Podolak

    Could you explain :
    “Or at the very least, that it’s never been easier to add rounded corners to a DIV.” ?

    What do you mean by this ? With my last project I was using couple of rounded-corner-libraries and have chosen the least painful one – http://www.ruzee.com/blog/shadedborder/. In my opinion each library has it’s obstacles and you always need to make some compromise if you want it to be cross-browser.

    So what is this magic tool/technique you mention ? I’m willing to hear

  • http://www.helephant.com Helen

    For me the lack of server controls is a big reason that MVC doesn’t look too appealing to me because they’re a big help in reusing repeated elements on different pages. WebForms is definitely a framework that’s showing it’s age but I kind of feel like Microsoft threw the baby out with the bath water when they designed MVC.

  • Joe

    Amen.

  • http://agiloloty.blogspot.com Jeff Tucker

    I always say “It’s called HTML and it’s not hard.” I recently blogged about this in response to Jeff Atwood: http://agilology.blogspot.com/2008/07/tag-soup-sucks-hey-jeff-heres-better.html

    I’m working on a series where I’m going to take a crappy web application and make it good. I’ll be going over all the stuff that I preach. I’m going to keep this webforms at first just because I want to show that an elegant design is possible in webforms. I will later refactor to MVC. I’m short on time but I promise that I’ll get this up soon.

  • http://jimmybogard.lostechies.com Jimmy Bogard

    See, that’s why we ASP 3.0 developers need to stick together. Response.Write4Life

  • http://primedigit.com/ Will Shaver

    Actually… I’d counter that Javascript is the hardest tool in the box to use correctly. Harder than c#, sql, asp.net, webforms, html etc. It has several KEY differences to all other object oriented languages in the standard toolbox. Prototypal inheritance, functions are objects, objects are containers.

    Even worse is the massive amount of BAD information out there for javascript. For example the || is the “default” operator and has different meanings in Javascript than in c#!

    For more, read your crockford….