November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
You can try Request.RequestContext.GetContentLink(). that should get you what you are after.
Normally you pass along the values you need in the viewmodel. So expanding the viewmodel with what you need in the view / layout should be your first bet.
Storing it in viewbag is an alternative, don't like that one much. I'm a bit old school. If you are using Alloy variant of viewmodels you will also get the current page as part of your viewmodel...
Live Daniel said though, normally i onl use request.requestcontext.getcontentlink when i don't have it available on the model which is hardly every or in a block and need to know what page I am on. Hope that makes sense. you should be sending at least a viewmodel to the view if you are not comfortable sending the full pagedata model to the view.
Well the problem that i have is that on one page on the site there needs to be some javascripts put after the jquery and other scripts, so i cannot put these scripts in the block/page that will use them. Therefore on the root template (layout) i need to test for the selected page - as specified in the StartPage , and if this is the correct page i pop the scripts in to the output stream. They cannot be on every page, since the overhead is waaaay too much! My goal is to reduce overhead. This check has to happen for every page, so the layout would seem to be place to determine the boolean.
How can i get a reference to the current page within a simple view or layout? I tried "PageReference.SelfReference" but it just gives an exception.