Copied to clipboard

Flag this post as spam?

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


  • andrew shearer 512 posts 661 karma points
    Aug 24, 2011 @ 08:24
    andrew shearer
    0

    currentpage in Razor

    what method are you using to obtain the "current page"?

    at the moment we have a helper extension method to convert the dynamicNode to an iNode.

    i.e. var currentPage = @CurrentModel.ToNode();

    is there any preferred method?

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 24, 2011 @ 09:04
    Dirk De Grave
    0

    Andrew,

    @Model is equivalent to the "currentPage" in xslt, so you can use that one to get hold of the current node. And yes, it's a dynamic object, so you won't have intellisense in vs.net, but any custom property can be retrieved using @Model.propertyAlias or @Model.GetProperty("propertyAlias").Value

    Hope this helps.

    Regards

    /Dirk

  • andrew shearer 512 posts 661 karma points
    Aug 24, 2011 @ 09:17
    andrew shearer
    0

    hi Dirk, yes thats a good point, i probably should have mentioned that i understand that concept in my first post :)

    i guess what im trying to understand is why @model is a 'dynamicNode' and not an iNode? thanks

Please Sign in or register to post replies

Write your reply to:

Draft