This is a migrated thread and some comments may be shown as answers.
Getting "The type or namespace name 'ServiceLocator' does not exist in the namespace 'Telerik.Web.Mvc.Infrastructure' " Error.
4 Answers 70 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Uma
Top achievements
Rank 1
Uma asked on 16 Nov 2010, 08:49 PM
Hi,
I have upgraded my project from "2010.2.930" to "2010.3.1110" version. I'm getting the below error on compiling the project.
"The type or namespace name 'ServiceLocator' does not exist in the namespace 'Telerik.Web.Mvc.Infrastructure' (are you missing an assembly reference?) "

<% var varAuthorization = Telerik.Web.Mvc.Infrastructure.ServiceLocator.Current.Resolve < Telerik.Web.Mvc.Infrastructure.INavigationItemAuthorization>(); %>
<%= Html.Telerik().Menu()
    .Name("Menu")
    .BindTo("SiteMap")   
    .ItemAction(item =>
                {
                    bool isAccessible = true;
                    foreach (var child in item.Items)
                    {
                        isAccessible = false;
                        if (child.IsAccessible(varAuthorization, ViewContext))
                        {
                            isAccessible = true;
                            break;
                        }
                        item.Visible = isAccessible;
                    }
     })
    .ClientEvents(events => events.OnSelect("onSelect"))
    %>

Is this a bug? Any suggestions to fix the issue?

Regards,
Uma

4 Answers, 1 is accepted

Sort by
0
Accepted
Ryan Haugh
Top achievements
Rank 1
answered on 19 Nov 2010, 01:48 AM
It looks like they changed they made a few changes to their code base.  Try the following instead:

<% var varAuthorization = DI.Current.Resolve < Telerik.Web.Mvc.Infrastructure.INavigationItemAuthorization>(); %>

Hope this helps.

Ryan
0
Uma
Top achievements
Rank 1
answered on 19 Nov 2010, 03:15 PM
Hi Ryan,
Thanks for your response. It worked.

Regards,
Uma
0
Alexandre Jobin
Top achievements
Rank 1
answered on 17 Jun 2011, 03:56 PM
Im using v2011.1.414.340 and i can't find the Resolve method and it doesnt seems to be DI.Current.Resolve

do you know what i should use with this version?

thank you!

alex
0
Alexandre Jobin
Top achievements
Rank 1
answered on 17 Jun 2011, 04:00 PM
its ok... i've just found where it was hidden:

Telerik.Web.Mvc.Infrastructure.DI.Current.Resolve<Telerik.Web.Mvc.Infrastructure.INavigationItemAuthorization>();
Tags
Menu
Asked by
Uma
Top achievements
Rank 1
Answers by
Ryan Haugh
Top achievements
Rank 1
Uma
Top achievements
Rank 1
Alexandre Jobin
Top achievements
Rank 1
Share this question
or