Combo box event handler

  1. #1

    Combo box event handler

    Hello

    I want to call a server side function when I change the value in a combo box. I cannot add event handler.

    
    <ext:Window ID="Window1" runat="server" Collapsible="true" Icon="Application"
            Title="Enter new player bio" Width="600" Height="400" Closable="False" Layout="FormLayout" Padding="7">
            <Items>
    
                <ext:ComboBox ID="ComboBox4" runat="server" FieldLabel="Bowling hand">
                <Listeners>
                
                    <Change Handler="Ext.net.DirectMethods.hideControls();" />
                
                </Listeners>
                <Items>
                
                                    <ext:ListItem Text="left" Value="left" />
                                    <ext:ListItem Text="right" Value="right" />
                                    <ext:ListItem Text="does not bowl" Value="does not bowl" />
                </Items>
    
                </ext:ComboBox>
    
    </Items>
    
    <Buttons>
            
                <ext:Button ID="Button1" runat="server" Text="Submit">
    
                    <DirectEvents>
                    
                       <Click OnEvent="func2" />
    
                    </DirectEvents>
    
                </ext:Button>
    
            </Buttons>
    
                
    </ext:Window>
    This is the script part:

    
     <script runat="server">
            [DirectMethod]
            protected void hideControls(object sender, EventArgs e)
            {
                if (ComboBox4.SelectedItem.Value == "does not bowl")
                {
                    ComboBox6.Visible = true;
                }
                else
                {
                    ComboBox5.Visible = true;
                }
            }
    </script>
    Note:
    • The window is inside a desktop
    • The web form also has a code behind file


    Note:
    When I write this:
    
    <Focus Handler="Ext.net.DirectMethods.hideControls();" />
    something happens...i cannot expand the combo box to see the values it has

    Thanks
    Last edited by Shuaib; Apr 21, 2012 at 5:34 PM.
  2. #2
    Quote Originally Posted by Shuaib View Post
    Hello

    I want to call a server side function when I change the value in a combo box. I cannot add event handler.

    
    <ext:Window ID="Window1" runat="server" Collapsible="true" Icon="Application"
            Title="Enter new player bio" Width="600" Height="400" Closable="False" Layout="FormLayout" Padding="7">
            <Items>
    
                <ext:ComboBox ID="ComboBox4" runat="server" FieldLabel="Bowling hand">
                <Listeners>
                
                    <Change Handler="Ext.net.DirectMethods.hideControls();" />
                
                </Listeners>
                <Items>
                
                                    <ext:ListItem Text="left" Value="left" />
                                    <ext:ListItem Text="right" Value="right" />
                                    <ext:ListItem Text="does not bowl" Value="does not bowl" />
                </Items>
    
                </ext:ComboBox>
    
    </Items>
    
    <Buttons>
            
                <ext:Button ID="Button1" runat="server" Text="Submit">
    
                    <DirectEvents>
                    
                       <Click OnEvent="func2" />
    
                    </DirectEvents>
    
                </ext:Button>
    
            </Buttons>
    
                
    </ext:Window>
    This is the script part:

    
     <script runat="server">
            [DirectMethod]
            protected void hideControls(object sender, EventArgs e)
            {
                if (ComboBox4.SelectedItem.Value == "does not bowl")
                {
                    ComboBox6.Visible = true;
                }
                else
                {
                    ComboBox5.Visible = true;
                }
            }
    </script>
    Note:
    • The window is inside a desktop
    • The web form also has a code behind file


    Note:
    When I write this:
    
    <Focus Handler="Ext.net.DirectMethods.hideControls();" />
    something happens...i cannot expand the combo box to see the values it has

    Thanks
    When you make directMethod and gave that 2 parameters then you simply can't write this:
    <Focus Handler="Ext.net.DirectMethods.hideControls();" />
    your method on server side should parameterless to make it work.

    Hope this help.

Similar Threads

  1. Replies: 4
    Last Post: Jun 29, 2012, 1:36 PM
  2. [CLOSED] Event handler before direct event handlers
    By matejgolob in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 08, 2012, 2:31 PM
  3. Replies: 3
    Last Post: May 11, 2010, 10:36 AM
  4. Show event handler for more then one syncSize
    By fabiomarcos in forum 1.x Help
    Replies: 1
    Last Post: Jan 22, 2009, 11:39 AM
  5. Event onCLick and Handler.
    By flaviodamaia in forum 1.x Help
    Replies: 4
    Last Post: Sep 03, 2008, 11:42 AM

Posting Permissions