Widget Global Variable or ViewState ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 年 前
Hi there.

I need to save some page content using a widget and flush it on page load, using same widget at the end of page.

So, is it possible do something like this:

@Html.Widget("store_variable", "save-this") at any view

and

@Html.Widget("read_variable") (and "save this" should be returned) at root foot.

??

Thanks!
6 年 前
This page has good information about what nopCommerce Html.Widgets are used for: http://docs.nopcommerce.com/display/en/Widgets
6 年 前
Thanks.

But my question is not about Widget itself. It is about keep some data while page is loading between all widgets.

I need to save some data used on page header widget and get it on last widget at bottom page (last widget processed).

So, ViewData is not helping once each partial views uses it viewdata. Session and Cache wont work because it needs to be unique on each pageview.
6 年 前
Your question is related to .net MVC functionality and not nopCommerce specific!  Having said that, look into potentially using a call similar to:

 var myPerRequestVariable = httpContext.Items["someKey"]


Here's Microsoft documentation: https://msdn.microsoft.com/en-us/library/system.web.httpcontext.items(v=vs.110).aspx

Hope that helps!
6 年 前
Now that I think about it, also see PerRequestCacheManager (which is nop's wrapper for httpContext)
6 年 前
AdamK wrote:
Your question is related to .net MVC functionality and not nopCommerce specific!


I know it, that is why it is on GENERAL SUPPORT forum :P

But ok, thanks, I will search about it.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.