Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nate 143 posts 184 karma points
    Sep 02, 2011 @ 21:10
    Nate
    0

    The name 'Parameter' does not exist in the current context

    I'm opening up my .cshtml files in visual studio and I get the following error:

    The name 'Parameter' does not exist in the current context

    I get these because I have 

    @Parameter.pageIndex 
    

    I can still save my files and run them in umbraco, but it's annoying to have all these errors.  Does anyone know how I can make it so Visual Studio doesn't see these errors?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 12, 2011 @ 18:13
    Sebastiaan Janssen
    0

    I'm not sure why you're getting this error, I don't see it. Is this in VS2010? Do you have both MVC2 and MVC3 installed??

  • Nate 143 posts 184 karma points
    Sep 12, 2011 @ 22:00
    Nate
    0

    VS2010 SP1 with both MVC2 and MVC3 installed.

    I'm opening the umbraco site as a "website" in visual studio.  Maybe that has something to do with it?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 13, 2011 @ 00:07
    Sebastiaan Janssen
    0

    I do the same.. I do have Resharper installed though, that might make the difference.. Does putting this using statement at the top help?

    @using umbraco.MacroEngines;
  • Jordi 25 posts 47 karma points
    Nov 19, 2011 @ 20:18
    Jordi
    0

    Hello. I am using VS2010 and Umbraco 4.7. I can use @Parameter with web matrix, and it works, but in Visual Studio opening the .cshtml file the error 'El nombre @Parameter no existe en el contexto actual' always appears.

    @using umbraco.MacroEngines does not solve the problem.

    Any ideas? Thanks

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 20, 2011 @ 21:56
    Sebastiaan Janssen
    0

    This doesn't appear for me. Are you sure you have VS2010 service pack 1 installed?]

    I don't get this error at all, but if you really need to fix this, you can always cast Paramater to dynamic, that should work.

  • Jordi 25 posts 47 karma points
    Nov 21, 2011 @ 23:02
    Jordi
    0

    I have installed now VS2010 SP1 and the error message still appears. I'll try to cast Parameter .. but I'm new to Razor.. and don't know yet how to do it. Thanks.

  • Barry Fogarty 493 posts 1129 karma points
    Nov 22, 2011 @ 00:14
    Barry Fogarty
    1

    Try

    @inherits umbraco.MacroEngines.DynamicNodeContext
  • Nate 143 posts 184 karma points
    Nov 23, 2011 @ 03:44
    Nate
    0

    Barry, that's it!  No more errors!  Thanks for answering a 3 month old question!

  • Jordi 25 posts 47 karma points
    Nov 25, 2011 @ 21:23
    Jordi
    0

    Thanks. Error has gone!

    So in order to have intelisense in VS and no errors I will always include these two sentences at the top of all cshtml files

    @using umbraco.MacroEngines;
    @inherits umbraco.MacroEngines.DynamicNodeContext

     

Please Sign in or register to post replies

Write your reply to:

Draft