So I’ve got a partial in my MVC project that creates a JSON array. I want to move this chuck of code from the top of the html page body to the bottom with the rest of the JS for speed reasons. That is to say I want to store the JSON created as a string in C# and access it on the Site.Master.
What’s the best option here?
Thanks,
Denis
Seems that ViewData is Top down only. So if you assign a value in the partials parent or a controller that’ll work but not the other way round. I managed to get it working using Context.Item
Context.Items[“JSONFeatures”] = “test”; on Partial
Context.Items[“JSONFeatures”].ToString(); on MasterPage
Hope this helps someone. I’m not sure if this is best practices but it works it I know better!