Friday, July 29, 2011

ASP.NET MVC Telerik Extensions

After installing the ASP.NET MVC Telerik Extensions, we couldn’t get the custom htmlhelpers working when using the Razor syntax.

Finally we discovered that the namespace was added to the root web.config

<add namespace="Telerik.Web.Mvc.UI" />

were it should have been added in the ~/Views/Web.Config:

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />    
<pages pageBaseType="System.Web.Mvc.WebViewPage">      
<namespaces>        
<add namespace="System.Web.Mvc" />        
<add namespace="System.Web.Mvc.Ajax" />        
<add namespace="System.Web.Mvc.Html" />        
<add namespace="System.Web.Routing" />        
<add namespace="Telerik.Web.Mvc.UI" />      
</namespaces>    
</pages>  
</system.web.webPages.razor>

Now our program already compiles and runs. However we still had a problem with Intellisense in Visual Studio. For a reason we didn’t understand we still had to add a @using Telerik.Web.Mvc.UI in every view.

Anyone who can confirm that this is a bug in the Razor Intellisense?

No comments: