[CLOSED] Change toggle state form server or client side

  1. #1

    [CLOSED] Change toggle state form server or client side

    I need to change toggle state from server and client side for a button, i am using pressed property on both, but only change internal state but image state not change.

    In this example, if click in a pressed button i'm trying to keep pressed the button on server and client side.

    Can i do that?

     
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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 void Page_Load(object sender, EventArgs e)
        {
            if (X.IsAjaxRequest)
            {
            }
            
        }
        protected void test_click(object sender, DirectEventArgs e)
        {
            if (!btnGrid.Pressed)
                btnGrid.Pressed = true;
        }
        
    </script>
     
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
        
     <ext:XScript ID="TokenScript1" runat="server">
        <script language="javascript" type="text/javascript">
            function jsTest(btn)
            {
                if (!btn.pressed)
                {
                    btn.pressed = true;
                }
            }
        </script>    
    </ext:XScript>
        
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
             <ext:ResourceManager ID="ResourceManager1" runat="server" />
             <ext:Panel ID="Panel1" runat="server" Region="Center" Layout="Fit" Html="test toggle">
                <TopBar>
                    <ext:Toolbar ID="Toolbar1" runat="server">
                        <Items>
                            <ext:Button ID="btnGrid" runat="server" Text="On direct event" Icon="Table"  EnableToggle="true" ToggleGroup="View" Pressed="true">
                                <DirectEvents>
                                    <Click OnEvent="test_click" >
                                        <EventMask ShowMask="true" />
                                    </Click>
                                </DirectEvents>
                            </ext:Button>
                            <ext:Button ID="btnGraph" runat="server" Text="On listener" Icon="ChartOrganisation" EnableToggle="true" ToggleGroup="View">
                                <Listeners>
                                    <Click Handler="jsTest(#{btnGraph})" />
                                </Listeners>
                            </ext:Button>
                            
                        </Items>
                    </ext:Toolbar>
                </TopBar>
            </ext:Panel>
        </div>
        </form>
    </body>
    </html>
    Last edited by geoffrey.mcgill; Feb 19, 2011 at 9:27 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please use 'toggle' method
    toggle( [Boolean state], [Boolean supressEvent] ) : Ext.Button
    If a state it passed, it becomes the pressed state otherwise the current state is toggled.
    Parameters:
    state : Boolean
    (optional) Force a particular state
    supressEvent : Boolean
    (optional) True to stop events being fired when calling this method.
    Returns:
    Ext.Button
    this
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    thanks Vladimir .

Similar Threads

  1. [CLOSED] Client and Server side form validation best solution
    By FAS in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Feb 09, 2012, 4:33 PM
  2. Replies: 3
    Last Post: Dec 26, 2011, 1:32 PM
  3. Replies: 1
    Last Post: Dec 01, 2010, 5:14 PM
  4. Replies: 4
    Last Post: Mar 19, 2010, 11:35 AM
  5. Replies: 6
    Last Post: Sep 01, 2009, 1:06 PM

Tags for this Thread

Posting Permissions