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...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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...