This is a migrated thread and some comments may be shown as answers.

[Solved] Tag Telerik not recognized but the project builds

8 Answers 1425 Views
Installer and VS Extensions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alfredo
Top achievements
Rank 1
Alfredo asked on 04 Feb 2011, 05:41 PM
Hi all,
I'm new on Telerik and I want to ask you a question.
I installed it with the installer for MVC3 and all goes fine. 
I added the reference to my project and the line on web config in the namespace section. When I try to use Telerik tag VS2010 doens't recognize it suggesting me to add a using or something like that, but if i try to build the solution, I receive no error. 
And if I launch my application at runtime I got the error:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: 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 (are you missing a using directive or an assembly reference?)

Line 3:  <head>
Line 4:      <title>@ViewBag.Title</title>
Line 5:       @(Html.Telerik().StyleSheetRegistrar()
Line 6:                        .DefaultGroup(group => group
Line 7:                            .Add("telerik.examples.css")
 Should I add others lines code in web config to make recognize tag ?

Thanks in advance.

Regards.

8 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 04 Feb 2011, 05:55 PM
Hi Alfredo,

The build process is different from the design time experience, handled by Visual Studio, hence you don't get any errors while building the project.

Did you by any chance try creating a new project using the Razor view engine?
If that true, please add the following to your web.config file (under the configSections node) to get intellisense running:

<sectionGroup name="telerik">
            <section name="webAssets" type="Telerik.Web.Mvc.Configuration.WebAssetConfigurationSection, Telerik.Web.Mvc" requirePermission="false"/>
        </sectionGroup>

By the way, you could use the New Telerik MVC Project template too. The wizard will automatically add these registrations for you.

Let me know if that helps.

Kind regards,
Erjan Gavalji
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alfredo
Top achievements
Rank 1
answered on 04 Feb 2011, 07:39 PM
Hi,
thanks for reply. 
I added the snippet on config section, but I got the same behaviour...Tag not recognized and exception on runtime.
Unfortunately the project is yet activated and I can't now restart one with the Telerik template....next time i'll do !!! :)
Should I add others lines code?

Thanks,
Alfredo
0
Alfredo
Top achievements
Rank 1
answered on 07 Feb 2011, 09:49 AM
Hi,
I noticed that if I add the @using directly on the page it works. It seems that it doesn't see the line code on namespace section on web config. That's tell you something?

Thanks,
Alfredo
0
T. Tsonev
Telerik team
answered on 08 Feb 2011, 09:14 AM
Hi Alfredo,

The problem might be that you're registering the reference to Telerik.Web.Mvc.UI in the system.web / pages / namespaces tag in web.config. This will be ignored by the Razor view engine.

You have to use system.web.webPages.razor / pages / namespaces. Please see this help topic for detailed instructions:
http://www.telerik.com/help/aspnet-mvc/using-with-the-razor-view-engine.html#NamespaceImports

Kind regards,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alfredo
Top achievements
Rank 1
answered on 10 Feb 2011, 12:31 PM
Hi, 
now I resolved with the update wizard on the Telerik menu in Visual Studio 2010. 
It works.

Thanks for help!
Alfredo
0
Hodgson
Top achievements
Rank 1
answered on 23 May 2011, 03:38 PM
Regarding @Tsvetomir Tsonev last post: use the  web.config file in your Views directory, not the main web.config file.
0
eddie
Top achievements
Rank 1
answered on 22 Aug 2011, 01:35 PM
Thanks! Adding this to the web.config inside of "views" worked!

<add namespace="Telerik.Web.Mvc.UI" />
0
Eric
Top achievements
Rank 1
answered on 28 Mar 2012, 08:18 PM
I'm having the same problem using the 1Q 2012 build of the MVC 3 tools.  I just started a new MVC 3 project using the Razor view engine, and wanted to get this working.  I just created a new Telerik MVC (Razor) project and compared my web.config files to the telerik project, and there were many many differences between them.  The interesting thing though is I get the same issue in both projects.  It thinks that the Telerik() namespace does not exist, and gives me an error in design time (however it works fine at run time).  Since it gives an error in design time, intellisense does not work, and this is a fairly large problem for me since I'm just starting out.  In both instances, at the point of @Html.Telerik(), there's a "System.Web.Mvc.HtmlHelper<dynamic>" error saying that it "doesn't contain a definition for Telerik and no extension method for Telerik accepting a first argument of type System.Web.Mvc.HtmlHelper<dynamic> could be found (Are you missing a using directive or assembly reference?)".

How do you get this set up so that intellisense will work in the editor using razor syntax since it does not work with a Telerik project template or when I set it up with a blank MVC project?

Update: I was able to get this working by following Nathan Smith's post at the end of this thread:

http://www.telerik.com/community/forums/aspnet-mvc/general/cannot-use-telerik-intellisense-in-razor-views-when-these-views-are-in-class-library.aspx 

Manually registering the Telerik.Web.Mvc.dll assembly in the GAC using GacUtil.exe seems to have worked for me.
Tags
Installer and VS Extensions
Asked by
Alfredo
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Alfredo
Top achievements
Rank 1
T. Tsonev
Telerik team
Hodgson
Top achievements
Rank 1
eddie
Top achievements
Rank 1
Eric
Top achievements
Rank 1
Share this question
or