Copied to clipboard

Flag this post as spam?

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


  • MB 273 posts 936 karma points
    Oct 21, 2017 @ 12:15
    MB
    0

    Intelligense in VS Pro 2015 (cshtml file)

    Hi guys, how do I get intelligense to work when editing my .cshtml file?

    • Visual Studio Professional 2015 (14.0.25431.01 update 3)
    • Umbraco 7.7.3.
    • See first picture for VS text editor
    • See second image for what is "excluded" in my solution

    Code example:

     @{ var selection = CurrentPage.Site().Children.Where("Visible"); }
        @foreach (var item in selection)
        {
        item.NoIntelligense
        }
    

    enter image description here enter image description here

  • Matt Darby 28 posts 391 karma points c-trib
    Oct 21, 2017 @ 17:31
    Matt Darby
    101

    Using CurrentPage returns content dynamically, which will not let you use Intellisense.

    You can use Model.Content, which is strongly typed, to use Intellisense. More info and examples found here:

    https://our.umbraco.org/documentation/Reference/Templating/Mvc/querying

    Why strongly typed is the way to go:

    https://our.umbraco.org/documentation/Reference/Common-Pitfalls/#dynamics

  • MB 273 posts 936 karma points
    Oct 22, 2017 @ 11:10
    MB
    0

    Thank you for your reply Matt and for the documentation link, you rock!

Please Sign in or register to post replies

Write your reply to:

Draft