Applying Custom Theme

Page 1 of 2 12 LastLast
  1. #1

    Applying Custom Theme

    Hi !

    I have searched the post about themming but no luck...
    I trying this to apply a custom theme on page load:

            protected void Page_Load(object sender, EventArgs e)
            {
                string themePath;
                
                var sm = this.ScriptManager1;
    
                themePath = "/custonThemes/black/css/xtheme-black.css";
    
                Theme temp = (Theme)Enum.Parse(typeof(Theme), themePath);
    
                sm.SetTheme(temp);
            }
    But I´m affraid there´s something missing here I cannot figure out.
    Error on line: Theme temp = (Theme)Enum.Parse(typeof(Theme), themePath);

    Best regards,

    Fabio
  2. #2

    RE: Applying Custom Theme

    Hi Fabio,

    Can you just add as a <link> tag within the <head> of your Page?


    Example


    <link href="/custonThemes/black/css/xtheme-black.css" type="text/css" rel="stylesheet" />

    Of course, you have to ensure the href path is correct.


    Hope this helps.


    Geoffrey McGill
    Founder
  3. #3

    RE: Applying Custom Theme

    Thank´s Geoffrey,

    But I need to change it on server side (page load) because the client will choose among some themes and apply one. I cannot figure out how could it be achieved with <link>.

    Best regards.

    Fabio
  4. #4

    RE: Applying Custom Theme

    Maybe using a LiteralControl would be an option.

    Geoffrey McGill
    Founder
  5. #5

    RE: Applying Custom Theme

    Try the following...

    Example


    this.ScriptManager1.RegisterClientStyleInclude("black", "/custonThemes/black/css/xtheme-black.css");

    Hope this helps.


    Geoffrey McGill
    Founder
  6. #6

    RE: Applying Custom Theme

    Just perfect.

    Thank´s

    Best regards
  7. #7

    RE: Applying Custom Theme

    Please help this does not seem to work, apply the theme once the scriptmanager has already been created.

    override protected void OnInit(EventArgs e)
    {
    //Add script manager to default page
                Coolite.Ext.Web.ScriptManager scmanager = (Coolite.Ext.Web.ScriptManager)this.Page.FindControl("ExtScriptManager");
    
                if (scmanager == null)
                {
                    Coolite.Ext.Web.ScriptManager script = new Coolite.Ext.Web.ScriptManager();
                    script.CleanResourceUrl = false;
                    script.RenderScripts = Coolite.Ext.Web.ResourceLocationType.Embedded;
                    script.ScriptMode = Coolite.Ext.Web.ScriptMode.Release;
                    script.ID = "ExtScriptManager";
                    this.Page.Controls.Add(script);
                }
    }
    Changing themes does not seem to work if the scriptmanager has already been created?

    override protected void Render(System.Web.UI.HtmlTextWriter writer)
    {
        Coolite.Ext.Web.ScriptManager scmanager = (Coolite.Ext.Web.ScriptManager)this.Page.FindControl("ExtScriptManager");
    
        if (scmanager != null) 
        { 
            if (Session["Coolite.Theme"] != null) 
            { 
                string theme = Session["Coolite.Theme"].ToString(); 
                scmanager.RegisterClientStyleInclude("black", theme); 
            } 
            else 
            { 
                scmanager.Theme = Coolite.Ext.Web.Theme.Default; 
            } 
        }
    }
  8. #8

    RE: Applying Custom Theme

    Yes,

    You´re right.
    It worked perfect on my localhost, but seems not work when uploaded to server (I take care about path´s).

    Some clue ?
  9. #9

    RE: Applying Custom Theme

    Any Help?
  10. #10

    RE: Applying Custom Theme

    Not so far...

    I will try to embbed my theme to coolite DLL.
    The problem is I dont´t know how to do it.
    I´ve asked to "Maras54" member how to do it but no answer so far.

    I´ll keep trying, and will post some hint when I find one.

    Regards
Page 1 of 2 12 LastLast

Similar Threads

  1. Applying custom styles on Ext.Net controls
    By MarianDaniel in forum 2.x Help
    Replies: 4
    Last Post: Jul 02, 2012, 8:32 PM
  2. Custom Theme
    By Rupesh in forum 1.x Help
    Replies: 0
    Last Post: Apr 18, 2012, 7:03 AM
  3. Replies: 14
    Last Post: Feb 16, 2011, 1:38 PM
  4. Theme changing not applying in side tabs
    By arunsathyan in forum 1.x Help
    Replies: 3
    Last Post: Jul 23, 2010, 9:25 AM
  5. [CLOSED] Problem in applying theme to web page in Tab Panel
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 03, 2009, 11:59 PM

Posting Permissions