Woah, Nellie.NET!

From my simple mind to… mine…

MVC ActionLinks

leave a comment »

The ASP.NET MVC framework comes with a series of helper methods that allow for the generation of links in a strongly typed fashion.

                <li><%=Html.ActionLink<ProfileController>(controller => controller.Index(), “my profile+account”) %></li>

This code results in the generation of the following html:

                <li><a href=”/Profile” >my profile+account</a></li>

The ASP.NET MVC engine looked in the routing tables for the mapping of the profile controller’s Index method and reverse mapped it to the “/Profile” URL listed above. Cool!!! Great, right?!

Well, I suppose if you’re a very developer centric shop, it’s fantastic. However, if you have designers and/or site developers, I can imagine this adding a bit of learning curve to their day to day tasks in the html (“Uhh… what’s a controller?”).

As for me, I like it… prefer it. Still, for large, multi-functional teams, it might just be easier to type out the html “<a href=…” instead of relying on yet another abstraction to generate a link, even if it is more prone to errors. *shrug*


Written by Nelson

April 20, 2008 at 8:26 pm

Posted in .NET, Web Development

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: