I have set up a site wide default style set name by putting entries in the config file and it works fine. Now I want to allow the user to change their site wide style sets at run time and override this default in C# code. Any ideas? Here is what I use in my config file to set the default: <section name="infragistics.web" type="System.Configuration.SingleTagSectionHandler,System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /><infragistics.web styleSetPath="~/Styles/" styleSetName="ElectricBlue" />
Thanks
I figured it out. The real name space you need to be using is:
"using Infragistics.Web.UI.Framework.AppStyling;"
The documentation says you should use:
"using Infragistics.WebUI.Shared.AppStyling;"
using Infragistics.WebUI.Shared.AppStyling;"
using
That compiles but does not work. Thanks for your help with this I appreciate your assistance.
My guess is that you're setting the StyleSetName too late in the execution of the page cycle. Try this - in the page_init set the StyleSetName to something other than "Default" and see if that works. If it does, then it's just a timing issue. If that doesn't work, then something much stranger is going on.
If you take a look at the source code for the samples that ship with NetAdvantage, the "showcase" samples all use dynamic styling. If you just do a global search for "StylesetName" you should find the code where we're setting the values. That may prove helpful to you.
I haven't heard of issues with the App Styling Config tool not working in VS2008, luckily the changes it makes are pretty easy to do by hand. Still, I'll forward this information on to the tools team and see if they have any more info. You might want to log a formal support incident (http://es.infragistics.com/gethelp)
Thanks Tony,
I tried exactly what this article said to do verbatim when I located it earlier this afternoon but was not able to get it to work. When I try this I get the default style all the time. I debugged it and the code is being called and the StyleSetName is correct, is the correct case, and in the right directory (I know because when I use the same StyleSetName in the config file I get it as the default for all my pages).
Any ideas that I should chase down?
Also I noticed that when I use the Application Styling Configuration tool in VS 2008 it does not make any changes to the config file.
You can modify the current StyleSet dynamically through code. Take a look at the Application Styling topic in the help file.
The trick is associating an application style with an entire domain. That can be done through a Browser cookie. If you add a cookie for your domain and store a value in there that corresponds to the application style the user chose, you can set the application style based on that cookie value, when each one of your applications loads.
Hope this helps,
-Tony