Razor HtmlHelper Extensions (or other namespaces for views) Not Found

Since the Beta, Razor uses a different config section for globally defining namespace imports. In your Views\Web.config file you should add the following: <configSections> <sectionGroup name=”system.web.webPages.razor” type=”System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″> <section name=”host” type=”System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ requirePermission=”false” /> <section name=”pages” type=”System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ requirePermission=”false” /> </sectionGroup> </configSections> <system.web.webPages.razor> <host factoryType=”System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, … Read more

How can I add a class attribute to an HTML element generated by MVC’s HTML Helpers?

In order to create an anonymous type (or any type) with a property that has a reserved keyword as its name in C#, you can prepend the property name with an at sign, @: Html.BeginForm(“Foo”, “Bar”, FormMethod.Post, new { @class = “myclass”}) For VB.NET this syntax would be accomplished using the dot, ., which in … Read more

HTML.ActionLink method

I think what you want is this: ASP.NET MVC1 Html.ActionLink(article.Title, “Login”, // <– Controller Name. “Item”, // <– ActionMethod new { id = article.ArticleID }, // <– Route arguments. null // <– htmlArguments .. which are none. You need this value // otherwise you call the WRONG method … // (refer to comments, below). ) … Read more