[FIXED] [V0.8.0] Setting ScriptManager Theme to Default

  1. #1

    [FIXED] [V0.8.0] Setting ScriptManager Theme to Default

    If you set a scriptmanager object's theme to something other than the default when first loaded and then change it to the default, it won't load (or Coolite.Ext.setTheme('Default') doesn't seem to work properly).

    For example:

    <%@ Page Language="C#" AutoEventWireup="true" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
     protected override void OnLoad(EventArgs e) {
      base.OnLoad(e);
    
    
      this.ScriptManager.Theme = Coolite.Ext.Web.Theme.Slate;
     }
    
    
     [AjaxMethod]
     public string GetThemeUrl(string theme) {
      var sm = this.ScriptManager;
      Theme temp = (Theme)Enum.Parse(typeof(Theme), theme);
      return (temp == Coolite.Ext.Web.Theme.Default || sm == null ? "Default" : sm.GetThemeUrl(temp));
     }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
      <ext:ScriptManager ID="ScriptManager" runat="server" HideInDesign="true" />
      <ext:Panel runat="server" Header="false" Height="400" Border="false" EnableViewState="false">
       <TopBar>
        <ext:Toolbar runat="server">
         <Items>
          <ext:ToolbarButton Text="Home" Icon="HouseGo" runat="server">
           <Listeners>
            <Click Handler="alert('Home');" />
           </Listeners>
          </ext:ToolbarButton>
          <ext:ToolbarFill />
          <ext:ComboBox EmptyText="Choose Theme" Width="100px" Editable="false" TypeAhead="true" ID="selTheme" runat="server">
           <Items>
            <ext:ListItem Text="Default" Value="Default" />
            <ext:ListItem Text="Gray" Value="Gray" />
            <ext:ListItem Text="Slate" Value="Slate" />
           </Items>
           <Listeners>
            <Select Handler="Coolite.AjaxMethods.GetThemeUrl(#{selTheme}.getValue(),{
             success: function (result) {
              Coolite.Ext.setTheme(result);
             }
            });" />
           </Listeners>
          </ext:ComboBox>
         </Items>
        </ext:Toolbar>
       </TopBar>
       <Body>
        <div class="x-window-mc" style="height: 250px;">
         Content Here
        
    
       </Body>
      </ext:Panel>
        </form>
    </body>
    </html>
    When the page loads it's using the slate theme. Set it to gray and it works just fine. But then set it to default and it never moves off gray.

    Refresh the page and then immediately select default. It stays on slate. That seems like a bug to me.

  2. #2

    RE: [FIXED] [V0.8.0] Setting ScriptManager Theme to Default



    Refreshing the page, btw, isn't an option for us. Any thoughts?
  3. #3

    RE: [FIXED] [V0.8.0] Setting ScriptManager Theme to Default

    I'd like to bump this one to the "premium" category if I may. It's pretty important to us.

    Perhaps I'll stop being lazy and go check it out for myself and propose a fix. Then again, maybe not... (c:
  4. #4

    RE: [FIXED] [V0.8.0] Setting ScriptManager Theme to Default

    Hi David,

    Unfortunately this did not get fixed for v0.7 (ran out of time) but I will get this fixed asap. I have confirmed dynamically switching Theme's is an issue when a Theme otherthan "Default" is set on initial Page_Load.




    Geoffrey McGill
    Founder
  5. #5

    RE: [FIXED] [V0.8.0] Setting ScriptManager Theme to Default



    Any updates? (c:
  6. #6

    RE: [FIXED] [V0.8.0] Setting ScriptManager Theme to Default

    Hi David,

    We fixed SetTheme functionality. Please update from SVN

    Here is test case:
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                if(!Ext.IsAjaxRequest)
                {
                    ToDefault.Pressed = this.ScriptManager1.Theme == Coolite.Ext.Web.Theme.Default;
                    ToGray.Pressed = this.ScriptManager1.Theme == Coolite.Ext.Web.Theme.Gray;
                    ToSlate.Pressed = this.ScriptManager1.Theme == Coolite.Ext.Web.Theme.Slate;
                }
            }
            
            protected void SetTheme(object sender, AjaxEventArgs e)
            {
                Theme theme = (Theme)Enum.Parse(typeof(Theme), e.ExtraParams["Theme"]);
                this.ScriptManager1.SetTheme(theme);
            }
        </script>
    </head>
    <body style="margin: 10px;">
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" Theme="Slate" />
            
            <ext:Button ID="ToDefault" runat="server" Text="Default" ToggleGroup="theme">
                <AjaxEvents>
                    <Click OnEvent="SetTheme">
                        <ExtraParams>
                            <ext:Parameter Name="Theme" Value="Default" Mode="Value" />
                        </ExtraParams>
                    </Click>
                </AjaxEvents>
            </ext:Button>
            
            <ext:Button ID="ToGray" runat="server" Text="Gray" ToggleGroup="theme">
                <AjaxEvents>
                    <Click OnEvent="SetTheme">
                        <ExtraParams>
                            <ext:Parameter Name="Theme" Value="Gray" Mode="Value" />
                        </ExtraParams>
                    </Click>
                </AjaxEvents>
            </ext:Button>
            
            <ext:Button ID="ToSlate" runat="server" Text="Slate" ToggleGroup="theme">
                <AjaxEvents>
                    <Click OnEvent="SetTheme">
                        <ExtraParams>
                            <ext:Parameter Name="Theme" Value="Slate" Mode="Value" />
                        </ExtraParams>
                    </Click>
                </AjaxEvents>
            </ext:Button>
            
        </form>
    </body>
    </html>
    Please note that AjaxMethod from your example should be changed as the following
    [AjaxMethod]
     public string GetThemeUrl(string theme) {
      var sm = this.ScriptManager;
      Theme temp = (Theme)Enum.Parse(typeof(Theme), theme);
      return sm.GetThemeUrl(temp));
     }

    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. Set default theme to slate
    By Sameera in forum 1.x Help
    Replies: 1
    Last Post: Aug 18, 2011, 3:57 AM
  2. Scriptmanager Theme
    By joao.msdn in forum 1.x Help
    Replies: 0
    Last Post: Apr 27, 2010, 9:56 AM
  3. Setting Theme
    By kumarxlnt in forum 1.x Help
    Replies: 1
    Last Post: Oct 21, 2009, 11:21 AM
  4. [CLOSED] ScriptManager Theme to Default (Client side)
    By davidhoyt in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 22, 2008, 5:20 PM
  5. [CLOSED] Error while setting theme in web.config
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 25, 2008, 7:54 AM

Posting Permissions