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
Hi,
I am looking for the best way to set a variable in the master layout, and then access it in all of its children. I tried ViewBag but it didn't work.
Cheers Eli
Hi Eli
You can pass data as a model to a partial view from the master template.
Thanks,
Alex
Hi Alex. Thanks.
But I render the child as RenderBody() and not as a partial view. Is there a way to share the variable with it?
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
Share variable from master layout to children
Hi,
I am looking for the best way to set a variable in the master layout, and then access it in all of its children. I tried ViewBag but it didn't work.
Cheers Eli
Hi Eli
You can pass data as a model to a partial view from the master template.
Thanks,
Alex
Hi Alex. Thanks.
But I render the child as RenderBody() and not as a partial view. Is there a way to share the variable with it?
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.