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

How to change skin by coding for all page

5 Answers 533 Views
SkinManager
This is a migrated thread and some comments may be shown as answers.
Big Q
Top achievements
Rank 1
Big Q asked on 26 Oct 2010, 05:38 PM
Hi telerik team,
I have a OA system which has many pages (use frame, not masterpage),  it allowed user to choose skin which they like, and save it to database. When he login next time, system read the setting from database and set it to all the pages.
 
Above is what I want, but I have a problem:
first , I don't want to put the RadSkinManager to each page and write code " RadSkinManager.GetCurrent(this.Page).Skin=Session["UserSkin"]; "  on Page_Load(object sender, EventArgs e){} method,  because I have too many pages.
second: I don't want to put the RadSkinManager to an usercontrol, and drag it to every page.

Is there any other ways to implement my ideal, such as new a RadSkinManager in BasePage and let other pages inherit it ? Or let every control's skin property empty and change the default skin setting which was writen in web.config before page load ? Or some other way? How should I do ?

By the way, I write some code on Page_Load Method, it doesn't work....

protected void Page_Load(object sender, EventArgs e)
{
    Telerik.Web.UI.RadSkinManager skinManager = new Telerik.Web.UI.RadSkinManager();
    skinManager.Skin = "Forest";
}


Thanks very much.

5 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 27 Oct 2010, 01:50 PM
Hello Big Q,

First of all, please try not to post duplicate forum threads with the same question.

http://www.telerik.com/community/forums/aspnet-ajax/skin-manager/new-an-radskinmanager-but-it-doesn-t-work.aspx

You don't have to set the RadSkinManager's Skin property on every page - you can use the control's ability to store the skin name in the session automatically by setting PersistenceMode="Session". So you can set the control's Skin property only once, when the user logs in. However, you do need the RadSkinManager on every page.

Yes, you can use a custom base class for your pages and add a RadSkinManager to the page in the base class.

Greetings,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Big Q
Top achievements
Rank 1
answered on 27 Oct 2010, 02:04 PM
haha , I got it just now, below is my way

Create a BasePage.cs inherit from system.web.ui.page, and all the other page inherit it

protected override void OnPreInit(EventArgs e)
{
   base.OnPreInit(e);        
   RadSkinManager skinManager = new RadSkinManager();
   skinManager.Skin = xxxx    //here will be read from database
   Page.Controls.Add(skinManager);
  
   RadFormDecorator dd = new RadFormDecorator();
   Page.FindControl("form1").Controls.Add(dd);  
}

so it is with the RadFormDecorator , but it should use Page.FindControl("form1").Controls.Add() ,
otherwise it will cause an error, because of the added code in html is at the outer of </html> tag
0
Big Q
Top achievements
Rank 1
answered on 27 Oct 2010, 02:20 PM
hi,
I am sorry for posting duplicate forum threads,it won't be happen again.

"you can use the control's ability to store the skin name in the session automatically by setting PersistenceMode="Session". ”
"So you can set the control's Skin property only once, when the user logs in"

sorry, I am not understand what you mean clearly, I find a property named "PersistenceKey" with a default value "Telerik.Skin",  is this the key of Session ?
if you  means when user login, I should read her skin setting from db, and set the Session[Telerik.Skin] = GetSkinSetting(userid) ,
and then new a  RadSkinManager, add it to page, it will find the session automatically ?
0
Big Q
Top achievements
Rank 1
answered on 28 Oct 2010, 02:32 AM
I solved above question. But another one puzzled me, it's about RadFormDecroator

When I drag a FromDecorator in to page in the design environment, I can set the "DecoratedControls" property with mulity value, like this:
<telerik:RadFormDecorator ID="RadFormDecorator1" Runat="server"  DecoratedControls="Default, Textbox, Textarea" />,
But I don't know how to implement it by codeing? I can only do this:
formDecorator.DecoratedControls = FormDecoratorDecoratedControls.Textbox;
it cann't be given mulity values.....could you please tell me how to achieve it ?
0
Rumen
Telerik team
answered on 01 Nov 2010, 11:14 AM
Hi Big Q,

The DecoratedControls property is enum and you can set its options through server code using the following syntax:

formDecorator.DecoratedControls = FormDecoratorDecoratedControls.Textbox | FormDecoratorDecoratedControls.CheckBoxes | FormDecoratorDecoratedControls.Textarea;

Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
SkinManager
Asked by
Big Q
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Big Q
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or