CS1061: 'System.Web.Mvc.HtmlHelper<dynamic>' does not contain a definition for 'Telerik' and no extension method 'Telerik' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<dynamic>' could be found
I easily solved this by adding the following line to my master layout, but I am interested to know if anything can be done via web.config, as the normal namespace import in the Telerik instructions doesn't seem to work.
@using Telerik.Web.Mvc.UI
14 Answers, 1 is accepted
We are aware of this limitation. It seems that Razor does not read the namespaces from web.config. We have tried reporting that to Microsoft but haven't got any response. I am afraid this is beyond our control.
Regards,Atanas Korchev
the Telerik team

<?xml version="1.0"?>
<configuration>
<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, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Collections.Generic"/>
<add namespace="System.Linq"/>
<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"/>
<add namespace="Telerik.Web.Mvc.UI"/>
</namespaces>
</pages>
</system.web.webPages.razor>
<system.web>
<httpHandlers>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
<!--
Enabling request validation in view pages would cause validation to occur
after the input has already been processed by the controller. By default
MVC performs request validation before a controller processes the input.
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>

Thanks!

Solution
Add the following namespace entry to web.config in "Views" folder and it will work without @using statement
<add namespace="Telerik.Web.Mvc.UI" />
(doesn't work if you add namespace to main web.config)

EDIT:
I added the Telerik extensions via NuGet and everything works fine :)

Please make sure you add the namespace in the Views/web.config file, not Views/Shared/web.config
I hope this helps.
Regards,
Tsvetomir Tsonev
the Telerik team

The MenuPartial.cshtml is located in Views/Shared. I modified the web.config in the Views as well as under the main project. Unfrotunately, I'm still unable to call the using statement. Is there a better location to place the MenuPartial.cshtml instead of in the shared directory? It's going to be used in the master page etc.
Thanks,
Sid
The location of the view shouldn't matter as long as it in the Views folder and not in a separate Area. Can you please send us a stripped-down version of your project so we can debug it locally.
Greetings,
Tsvetomir Tsonev
the Telerik team

This issue is now resolved after building the solution.
Thanks,
Sid

Try this in your 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.Helpers"
/>
<
add
namespace
=
"System.Web.Mvc"
/>
<
add
namespace
=
"System.Web.Mvc.Ajax"
/>
<
add
namespace
=
"System.Web.Mvc.Html"
/>
<
add
namespace
=
"System.Web.Routing"
/>
<
add
namespace
=
"System.Web.WebPages"
/>
<
add
namespace
=
"Telerik.Web.Mvc.UI"
/>
<
add
namespace
=
"Telerik.Web.Mvc.Configuration"
/>
</
namespaces
>
</
pages
>
</
system.web.webPages.razor
>



I wanted to use cascade combo box in my project. I am not able to get the method "cascadeto" for combobox.It showing error
"Telerik.Web.Mvc.UI.Fluent.DropDownListBuilder' does not contain a definition for 'CascadeTo' and no extension method 'CascadeTo' accepting a first argument of type 'Telerik.Web.Mvc.UI.Fluent.DropDownListBuilder' could be found (are you missing a using directive or an assembly reference?)"
My Telerik.web.mvc dll version id "2011.2.712.340"..What shall I do now. Shall I use 2012 build. I was not able to down load even trial version of 2012 from ur site.
Thank you,
sree
MyEmail:sreekumargupta@gmail.com