Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET MVC > General Discussions > Unable to use Telerik in views?

Not answered Unable to use Telerik in views?

Feed from this thread
  • Julien Master avatar

    Posted on Jan 30, 2012 (permalink)

    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?

    Reply

  • Julien Master avatar

    Posted on Jan 30, 2012 (permalink)

    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 

    Reply

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Feb 2, 2012 (permalink)

    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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET MVC > General Discussions > Unable to use Telerik in views?