This is a migrated thread and some comments may be shown as answers.

Global Change of Skin

7 Answers 183 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
rdochert
Top achievements
Rank 1
rdochert asked on 19 Dec 2009, 03:06 AM
hi,
i've successfully registered a default skin for my application in the web.config file and it works great. what i'd like to do is give my users the oppertunity to select from the 6 or 7 default skins provided by Telerik and, based upon user selection, make that the global skin instead. is there a simple way to override the web.config setting and make it default for all controls?
thanks,
rob

7 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 19 Dec 2009, 07:24 AM
Hi Rob,

To my regret there is not an option to change the global skin in the runtime. You could use the RadSkinManager control on your pages though and use its Skin property to set a page-wide skin to the controls. You could further store that setting in a database on a per-user basis.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Chris
Top achievements
Rank 1
answered on 22 Nov 2011, 02:29 PM
Hello,

I was digging through the forums and I think this is the most relevant post to date.  

My question is: is there a way to change the global skin programmatically yet?  Will there ever be a way to do that?

I have a multi-site web application, so I would like for each site to be able to specify (or not specify) a global skin for all the Telerik controls to derive from.  I'm not sure if this is possible, but I can't seem to find anything that would indicate this is possible.  This could be a pretty big deal for me down the road since obviously customers want something that they can customize if it's their site.
0
Lini
Telerik team
answered on 22 Nov 2011, 04:51 PM
Hello,

Setting a default skin for the application is pretty easy - just add an app setting in the web.config:

<appSettings>
    <add key="Telerik.Skin" value="Simple"/>
</appSettings>

Changing this default skin after the application is started is even easier:

public void Page_Load(object sender, EventArgs e)
{
    System.Configuration.ConfigurationManager.AppSettings["Telerik.Skin"] = "Forest";
}

With these you should be able to set a default skin for all controls and change it programmatically when the application is running. Note that if you have set the skin property of a Telerik control instance, it will override the app setting value. For more information, see the following help article - http://www.telerik.com/help/aspnet-ajax/introduction-skin-registration.html

Kind regards,
Lini
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Chris
Top achievements
Rank 1
answered on 23 Nov 2011, 01:20 PM
Hi Lini,

This is very helpful!  The line inside the Page_Load is what I was looking for.  I have never seen that before.  I know this is more of an Asp.net question, but are there any drawbacks to that approach?  Is that value just good for the request?  Are there race-conditions?  I guess it's not actually changing the value in the web.config but I'm not clear what scope that change is valid for.

If you could provide some more feedback it would be greatly appreciated!
Chris
0
Lini
Telerik team
answered on 23 Nov 2011, 02:03 PM
Hello Chris,

You can read and write values to the ConfigurationManager.AppSettings - it is just a simple NameValueCollection object. However, the changes you make will persist only until the application's instance is killed for some reason. The Web.config file will not be modified if you change something in the collection and your changes will be reset if the application is recycled. To preserve the changes after a restart, you will need to change the Web.config file <appSettings> section manually.

Greetings,
Lini
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Chris
Top achievements
Rank 1
answered on 23 Nov 2011, 02:31 PM
Hi Lini,

Hmm.. yes, then it is application-scoped (which makes sense since it is app settings...), which would work sometimes in my situation, but would probably run into race condition issues if traffic was heavy across multiple sites.

Is there no other way to have a request-scoped setting of the "global" or default Telerik Skin?
0
Chris
Top achievements
Rank 1
answered on 23 Nov 2011, 02:45 PM
Hi Lini,

Thanks, I realized I can solve my issue without the global, but with RadSkinManager instead.

Thanks!
Tags
General Discussions
Asked by
rdochert
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Chris
Top achievements
Rank 1
Lini
Telerik team
Share this question
or