Release Candidates for ASP.NET MVC 5.1

Posted on Updated on

Attribute Routing

The Attribute Routing will now support the constraints, versioning enabled and header based route section. Many aspects of attribute routes are now customizable via the IDirectRouteProvider interface and RouteProviderAttribute class.

There’s a Web API-based sample here:
(https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/RoutingConstraintsSample/ReadMe.txt)
the concepts are the same as MVC.

Bootstrap support in HTML Helpers

Now, you can pass HTML attributes in Html.EditorFor as an anonymous object. This means you can pass in Bootstrap styles in HtmlHelpers and style the various input elements such as textboxes, dropdownlist etc. with the correct Bootstrap styles.

Support for Enums

Now in ASP.NET MVC 5.1, the Enum type will be supported in Views. The new HTML Helper Html.EnumDropDownListFor() added will generate a dropdown when binding to Enum types. For this you need to declare an Enum as follows:

When you use the EnumDropDownListFor Helper, it will generate the following view when you are creating an Enum. You can see a full sample at:
https://aspnet.codeplex.com/SourceControl/latest#Samples/MVC/EnumSample/

References:-

http://www.asp.net/visual-studio/overview/2013/aspnet-and-web-tools-20132-preview-for-visual-studio-2013-release-notes
http://blogs.msdn.com/b/webdev/archive/2013/12/09/asp-net-and-web-tools-2013-2-preview-for-visual-studio-2013.aspx

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