ASP.Net MVC BeginForm - Beta API Change

The refactoring of the helper method Html.Form in MVC to Html.BeginForm was published in the release notes as a simple renaming. During the beta upgrade process we noticed that a lot of our forms were rendering with blank actions.

If you too are having trouble with your forms, it is worth noting that the API has changed in a subtle but EXTREMELY significant way. The orignal method, whose signature looked like:

public static IDisposable Form(this HtmlHelper helper, string controllerName, string actionName)

Has been changed to read:

public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName)

Note that the parameters have been interchanged! So if you were using magic string-ness to get actions into your forms, you now have a bigger upgrade job than you thought. You will need to switch the parameter strings and put your controller where your action is - and vice versa.

This was tracked down in my team by Simon Sanderson (who we are assured is unrelated to MVC guru Steve). There is a confession of sorts from the MVC team here.

October 30, 2008 16:19 by steven.burman
E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Is today MVC day?

System.Web.MVC makes me a very happy man

After a barrage of blog posts and primers from the guys on the other side of the fence, it appears that today might be the day that System.Web.MVC is released.

To say that I am excited would be an understatement. Mainstream acceptance and support (from the big machine) means that we can now propose this style of development without fear of recrimination from cowering/OSS averse decision makers. To me this is the most powerful component of this release as it is by no means revolutionary from a technology standpoint.

I have the perfect project for MVC sitting in the wings and I can now unleash. Thanks Microsoft for having the vision to support the concepts that we developers hold dear. I accept that things from MS will never be on the bleeding edge, but at least they are beginning to get a lot closer.

I can't wait. Bring on the CTP!

December 7, 2007 22:30 by steven.burman
E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed