Copied to clipboard

Flag this post as spam?

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


  • Steve Kallal 9 posts 29 karma points
    Jan 06, 2012 @ 01:45
    Steve Kallal
    0

    Get id of current node

    I've googled this site and can't find a way to determine the node id of the the current node. Ideally I'd like to use @Model and determine the id, so I can pass to the NiceUrl function.

    It seems much of Umbraco coding assumes you already know the node id.

  • Owen 123 posts 246 karma points
    Jan 06, 2012 @ 07:34
    Owen
    0

    use @Model.Id to get current id, and use @Model.Url to get current page's url

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Jan 06, 2012 @ 14:01
    Dan Diplo
    0

    Check out http://our.umbraco.org/projects/developer-tools/razor-dynamicnode-cheat-sheet - it shows you all the properties and methods you have available on Model.

  • Jules 271 posts 562 karma points
    Jan 06, 2012 @ 14:51
    Jules
    0

    If you are using visual studio as well the check out this really useful youtube video by Doug Robar about debugging and getting full intellisense on DynamicNode - helped me no end

    http://www.youtube.com/watch?v=NgnKy-VTimU&hd=1 ;

    Good luck 

    J

  • Steve Kallal 9 posts 29 karma points
    Jan 06, 2012 @ 18:07
    Steve Kallal
    0

    I tried Visual Studio today. Had the site on a test server and had to pull the code back to my dev box and I could debug. Painly fully using Response.Write statements, lol... I need to point my local dev box to use the test server SQL database, so only the code needs to be synced (xcopy) back to test server. That should make debugging more convenient.

    Now that I see what NiceUrl URLs look like, I want to NOT so nice URLs. I don't need the host name in the URL, but rather starting with "/" instead. For example, /Services and not http://hostname/Services. Is there an easy way from get the host name and strip that part from the URL? Perhaps the Request object?

    I am using this to create a data driven menu for a jQuery Mobile site.

     

Please Sign in or register to post replies

Write your reply to:

Draft