Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Structure:
Base.cshtml @RenderBody()
RenderBody outputs ProductItem.cshtml which in turn has @Html.Partial("productItemTopInfo", Model.Content)
For a littany of reasons I have to pass a value from Base.cshtml to productItemTopInfo.cshtml. I thought of using ViewData but that didn't work. Looking on OS I saw http://stackoverflow.com/questions/27990225/how-to-use-viewdata-and-viewbag-with-umbraco-surface-controllers and on Our I saw https://our.umbraco.org/forum/developers/api-questions/36614-411-Using-SurfaceController-Child-Action-with-Post?p=2. Both seem to say you need to do a ViewData from Base.cshtml to ProductItem.cshtml, pick it up and apply it again to ViewData so it can be picked up at productItem.cshtml.
None of the above works. Am I doing it wrong, is there a better way with Umbraco?
Thanks,
Craig
Cache.Insert("my key name", "myValue");
var myNewValue = (string)Cache["my key name"];
.....was the answer, nothing to do with Umbraco (I think).
Hope this helps someone else.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Using ViewData in V7.2.2
Structure:
Base.cshtml
@RenderBody()
RenderBody outputs ProductItem.cshtml which in turn has @Html.Partial("productItemTopInfo", Model.Content)
For a littany of reasons I have to pass a value from Base.cshtml to productItemTopInfo.cshtml. I thought of using ViewData but that didn't work. Looking on OS I saw http://stackoverflow.com/questions/27990225/how-to-use-viewdata-and-viewbag-with-umbraco-surface-controllers and on Our I saw https://our.umbraco.org/forum/developers/api-questions/36614-411-Using-SurfaceController-Child-Action-with-Post?p=2. Both seem to say you need to do a ViewData from Base.cshtml to ProductItem.cshtml, pick it up and apply it again to ViewData so it can be picked up at productItem.cshtml.
None of the above works. Am I doing it wrong, is there a better way with Umbraco?
Thanks,
Craig
Cache.Insert("my key name", "myValue");
var myNewValue = (string)Cache["my key name"];
.....was the answer, nothing to do with Umbraco (I think).
Hope this helps someone else.
Craig
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.