skinmanager in master/detail pages

6 posts, 0 answers
  1. ehsan
    ehsan avatar
    27 posts
    Member since:
    Apr 2008

    Posted 09 Sep 2009 Link to this post

    hi telerik
    i have masterpage that use skin manager to change telerik controls appearences.

    master_page :
     <telerik:RadSkinManager ID="RadSkinManager1" runat="server" Skin="Forest" ShowChooser="True" PersistenceMode="Cookie"
                <TargetControls> 
                    <telerik:TargetControl ControlID="ContentPlaceHolder1" /> 
                </TargetControls> 
            </telerik:RadSkinManager> 
    all things is fine in my master page.

    i want  when i change skin with skinmanager combobox ,all things in my detail forms(aspx) changed to selected skin too.
    i use this solution in my detail forms (on load event) :
    default.aspx :
    RadSkinManager rmnew RadSkinManager (); 
    rm = (RadSkinManager)Master.FindControl("RadSkinManager1"); 
    RadSkinManager.GetCurrent(this.Page).ApplySkin(RadGrid1, rm.Skin); 
    but problem is that the on_load event of detail page occures after masterpage onload, then this solution change the appearnce of detail form by perevius selected skin ,and is diferent from current master page skin.

    i want sample solution that show me how i can change skin of my webapplication(telerik controls) completely by selecting skin in master page runtime.


  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 09 Sep 2009 Link to this post

    Hello ehsan,

    How to apply skins dynamically to RadControls using RadSkinManager in master/content page scenario you can see from this help article:

    http://www.telerik.com/help/aspnet-ajax/radskinmanager.html (the part under the ASPX section)

    The content page's OnLoad server event should be fired before that of the master page as outlined here:

    http://msdn.microsoft.com/en-us/library/dct97kc3.aspx

    If you logic requires that to be done in a reverse manner, consider intercepting the OnInit or OnPreRender events instead.

    Best regards,
    Sebastian
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chris Chubb
    Chris Chubb avatar
    7 posts
    Member since:
    Nov 2005

    Posted 22 Oct 2009 Link to this post

    I have a similar issue, but not quite the same. I am attempting to create and use the RadSkinManager dynamically, so I can encapsulate all of my code in the ascx module. I don't have control over the pages that the ascx control will be used on.

            Public RadSkinManagerLocal As RadSkinManager = Nothing 
            Private Sub Page_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load 
     
                Try 
                    'Try to get ahold of the current skin manager, otherwise create it 
                    RadSkinManagerLocal = RadSkinManager.GetCurrent(Me.Page) 
                    If (RadSkinManagerLocal Is NothingThen 
                        'Create it and set the local variable 
                        RadSkinManagerLocal = New RadSkinManager() 
                        RadSkinManagerLocal.ID = "RadSkinManagerLocal" 
                        Me.Controls.Add(RadSkinManagerLocal) 
                    End If 
                Catch ex As Exception 
                    Throw New ApplicationException("Exception Occured while attempting to hook up the Skin Manager: " & ex.Message) 
                End Try 
     
                RadSkinManagerLocal.TargetControls.Clear() 'Make sure that no controls are listed 
                RadSkinManagerLocal.Skin = "WebBlue" 
                RadSkinManagerLocal.Enabled = True 
     
     
    etc... 
            End Sub 
     

    This fails to set the local skin and when I view the source on the page I get no indication that there is even a RadSkinManager on the page. Am I doing something wrong with creating the skin manager dynamically?
  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 23 Oct 2009 Link to this post

    Hello Chris,

    RadSkinManager should always reside on the main page or master page in order to operate properly and style RadControls. If you would like to apply skins for controls which reside in content pages or user controls, you can do that dynamically using the ApplySkin(control, skinName) method from its server-side API.

    See the relevant paragraph of this help article for more details.

    Best regards,
    Sebastian
    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.
  6. Chris Chubb
    Chris Chubb avatar
    7 posts
    Member since:
    Nov 2005

    Posted 23 Oct 2009 Link to this post

    Sebastian, thanks for responding.

    So I can use the generic RadSkinManager object without actually instantiating a local object?

    If I apply a skin to a master object (Like a Splitter) with .ApplySkin(), will it automatically propagate down into the sub-panes and sliding panels and the like? Likewise with the tab menus? Or do I have to apply it to each Rad control by name? I ask this because some of my controls are a bit complex with Splitters that contain sliding panes that have tabs that have calendars, grids, etc. There may be 20 or more Rad controls in a single ASCX file. I am trying to write a generic function to paint the whole ASCX with the chosen skin because we will ultimately be writing our own skins and need a way to apply them across the board quickly. 

    I have done some programming before that iterated over controls looking for objects with iSkinnable interfaces to change skins on, but got lost because some of the Rad controls allow access to their contained collections of controls, but others don't recurse so cleanly. I was hoping that the RadSkinManager could do that for me.  If I don't specifically set a list of TargetControls(), can I read from that property to get all of the skinnable controls?

    The other thing I am having a hard time discovering from the documentation is that if I use the RadSkinManager, do I still have to manually add references to my custom skin CSS files for each type of control? Or if I put them in the /Skins/ directory (Like other skin names) then will it auto-load the various CSS files for me? If not, then I might as well go ahead and keep my recursion code to find skinnable controls. 

  7. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 23 Oct 2009 Link to this post

    Hello Chris,

    The ApplySkin method will apply the respective skin for the control you specify but will not propagate that skin for other nested RadControls which reside in templates/splitter panes. If you would like to set the same skin for all RadControls in the user control instance, you should either :
    • specify that through the Skin property of RadSkinManager itself and override that settings for other RadControls on the page through their own Skin property
    • traverse the nested RadControls and use the ApplySkin method for them independently

    Concerning your question about the css styles:
    If you use built-in skins or register the RadControls skins as external (see this topic for details), RadSkinManager should apply them without any extra modifications.

    Best regards,
    Sebastian
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017