How to change Master View based on global variable?


#1

Does anyone know how to change the Master View on a page based on the value of a global variable?

I have a project that requires certain elements to change color based on a ‘partner’ variable. This seems like it would be pretty easy using masters if I could find a way to change the master view based on passing a variable into the page.


#2

You’d need to use a dynamic panel rather than a master, although you could have a master within each state of the dynamic panel. You can then control which state the dynamic panel is according to your variable. Hope that helps


#3

See this recent thread for options about how to do this.

In general you can use the Page Loaded event in your Master to test global variable values and change your “views” by changing dynamic panel states, hiding/showing and/or selecting/unselecting widgets, etc.

If you want to change things dynamically in your Master (or anything on a page) and not just when the page loads, you can create a dynamic panel with at least two states, use its Loaded event to change the state to “next, wrap, repeat every N ms” so that it is constantly changing states, where ‘N’ is some reasonable delay short enough to make timely changes but not so short as to constantly use system resources and slow or lock up your web browser (I find 500 ms to be good in most cases.) Then use that panel’s State Changed event to test global variables.


closed #4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.