Change Icon in Panel from server-side

  1. #1

    Change Icon in Panel from server-side

    Is there a way to change the icon in a panel from the server side?
    <ext:Panel ID="Panel1" runat="server" Title="Visit Status" AutoHeight="true" Frame="True" Collapsible="true" TitleCollapse="true" BodyStyle="padding:15px;" Collapsed="false" Icon="stopred">
    change stopred to stopgreen
  2. #2

    RE: Change Icon in Panel from server-side

    Hi jmilton,

    At the moment, the best option would be to register the Icon.StopGreen during the intial Page_Load. Then during the AjaxEvent/AjaxMethod, setting Icon = Icon.StoreGreen will work.

    The following sample demonstrates.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                this.ScriptManager1.RegisterIcon(Icon.StopGreen);
            }
        }
        
        protected void Button1_Click(object sender, AjaxEventArgs e)
        {
            this.Window1.Icon = Icon.StopGreen;
        }
    
        protected void Button2_Click(object sender, AjaxEventArgs e)
        {
            this.Window1.Icon = Icon.StopRed;
        }
    </script>
    
    <!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>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />  
            
            <ext:Window 
                ID="Window1" 
                runat="server" 
                Title="Title" 
                Icon="StopRed">
                <Buttons>
                    <ext:Button ID="Button1" runat="server" Text="Set Green">
                        <AjaxEvents>
                            <Click OnEvent="Button1_Click" />
                        </AjaxEvents>
                    </ext:Button>
                    
                    <ext:Button ID="Button2" runat="server" Text="Set Red">
                        <AjaxEvents>
                            <Click OnEvent="Button2_Click" />
                        </AjaxEvents>
                    </ext:Button>
                </Buttons>
            </ext:Window>
           
        </form>
    </body>
    </html>
    Hope this helps.

    Geoffrey McGill
    Founder
  3. #3

    RE: Change Icon in Panel from server-side

    I am looking more at a solution where I have multiple panels on a page and want to notify my users when they have completed the entry requirements for a panel. I want to change the icon from red to green after the data is saved.

    James
  4. #4

    RE: Change Icon in Panel from server-side

    Geoffrey,

    I was able to get it to work with this.Panel1.Icon = Coolite.Ext.Web.Icon.StopGreen;

    Thanks,

    James

Similar Threads

  1. Replies: 3
    Last Post: Dec 26, 2011, 1:32 PM
  2. [CLOSED] change icon in Grid Panel. Urgent !!
    By schellappa in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 11, 2011, 4:45 PM
  3. [CLOSED] Change toggle state form server or client side
    By caha76 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 19, 2011, 8:46 PM
  4. Replies: 0
    Last Post: Nov 17, 2010, 9:32 PM
  5. Set Panel Icon Client Side
    By Tbaseflug in forum 1.x Help
    Replies: 2
    Last Post: Apr 29, 2009, 2:21 PM

Posting Permissions