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

[Solved] Unable to use Telerik in views?

2 Answers 188 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Julien
Top achievements
Rank 1
Julien asked on 30 Jan 2012, 11:12 AM
Hi,

I've some trouble using any asp.net MVC 3 components in my views.

When I try, I got this kind of exception :
Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper<VVVV.XXX.YYY.WWW.ZZZ.Areas.Advertiser.Models.AdsListModel>' does not contain a definition for 'Telerik' and no extension method 'Telerik' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<VVVV.XXX.YYY.WWW.ZZZ.Areas.Advertiser.Models.AdsListModel>' could be found (are you missing a using directive or an assembly reference?)

I'm only trying to display this:

@(Html.Telerik().PanelBar()
       .Name("PanelBar")
       .Items(items =>
       {
           items.Add().Text("Item 1");
                       
           items.Add().Text("Item 2")
                .Items(subItems =>
                      {
                          subItems.Add().Text("Sub Item 1");
                          subItems.Add().Text("Sub Item 2");
                          subItems.Add().Text("Sub Item 3");
                      });
       })
       .Render())


In one view of one of my area.

What is going wrong? 

I've also one instruction in the layout(for script/css registration), which doesn't seems to make any trouble.

Is this a problem with area?

2 Answers, 1 is accepted

Sort by
0
Julien
Top achievements
Rank 1
answered on 30 Jan 2012, 11:22 AM
I added the namespace declaration in the web.config file of the area,it seems it helped, but I'm still blocked:

With this error this time: 

CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments 
0
Georgi Tunev
Telerik team
answered on 02 Feb 2012, 11:56 AM
Hello Julien,

You need to use server blocks (@{}) instead of @() - the latter is used for Response.Write type of actions (like outputting a string from the server for example, where you don't need to run code).


Greetings,
Georgi Tunev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
General Discussions
Asked by
Julien
Top achievements
Rank 1
Answers by
Julien
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or