[CLOSED] linked ComboBox

  1. #1

    [CLOSED] linked ComboBox

    Hi,

    I put in my page two combobox and I want that filter one combobox if I select one item into another combobox, but my code does not work.
    I attached an example below

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <script runat="server">
    
            protected void ReloadComboBoxAction(object sender, DirectEventArgs e) {
                PopulateCombo();
            }
            
            protected void PopulateCombo() {
                IList list = null;
                if (comboBoxWorkCenterAction.SelectedItem == null || comboBoxWorkCenterAction.SelectedItem.Index == 0) {
                    
                    list = CreateItemsComboBoxOperation();
                } else {
                
                    list = CreateItemsComboBoxOperation1();
                }
                for (int i = 0;i < list.Count;i++) {
                    string operationIth = (string)list[i];
                    comboBoxOperationAction.Items.Add(new Ext.Net.ListItem(operationIth,i.ToString()));
                }
                
                comboBoxOperationAction.DataBind();
            }
            
            public IList CreateItemsComboBoxOperation() {
                IList listaOperation = new ArrayList();
                
                string element1 = "operation 01";
                string element2 = "operation 02";
                string element3 = "operation 03";
                
                
                listaOperation.Add(element1);
                listaOperation.Add(element2);
                listaOperation.Add(element3);
                
                return listaOperation;
            }
            
            public IList CreateItemsComboBoxOperation1() {
                IList listaOperation = new ArrayList();
                
                string element1 = "operation 01";
                string element3 = "operation 03";
                
                listaOperation.Add(element1);
                listaOperation.Add(element3);
                
                return listaOperation;
            }
            
            public void Page_Load() {
                PopulateCombo();
            }
            
    </script> 
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <h1>Example</h1>
           
            <ext:Panel runat="server" Layout="HBoxLayout" Border="false" AutoHeight="true" Header="false">
                <Defaults>
                    <ext:Parameter Name="margins" Value="5 5 0 5" Mode="Value" />
                </Defaults>
                <LayoutConfig>
                    <ext:HBoxLayoutConfig />
                </LayoutConfig>
                <Items>
                    <ext:ComboBox ID="comboBoxWorkCenterAction" runat="server" EmptyText="-- All --">
                        <Items>
                            <ext:ListItem Text="WorkCenter1" />
                            <ext:ListItem Text="WorkCenter2" />
                            <ext:ListItem Text="WorkCenter3" />
                        </Items>
                        <DirectEvents>
                            <Select OnEvent="ReloadComboBoxAction">
                                <EventMask ShowMask="true" MinDelay="200" />
                            </Select>
                        </DirectEvents>
                    </ext:ComboBox>
                    <ext:ComboBox ID="comboBoxOperationAction" runat="server" EmptyText="-- All --">
                    </ext:ComboBox>
                </Items>
            </ext:Panel>
        </form>    
    </body>
    </html>
    Can you help me for this issue?
    Thank you so much.
    Last edited by Daniil; Sep 21, 2012 at 12:23 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please wrap the Page_Load code in:
    public void Page_Load() {
        if (!X.IsAjaxRequest)
        {
            PopulateCombo();
        }
    }
    and replace
    comboBoxOperationAction.DataBind();
    with
    comboBoxOperationAction.GetStore().DataBind();
  3. #3
    Hi,

    ok now it works.

    Thanks.

    Why I don't receive an email when you reply to the thread?
  4. #4
    Quote Originally Posted by tactime10 View Post
    Why I don't receive an email when you reply to the thread?
    I think it was because of the forums didn't work well yesterday.

    But please check your Notification settings: Settings (at the top) => General Settings (at the left) => Messaging & Notification.

    There must be "Instantly, using email".
  5. #5
    The settings was correct. I think the forums didn't work well yesterday as you said me because now it works.
    Thanks
  6. #6
    Okay, thank you for confirming!

Similar Threads

  1. [CLOSED] Linked Combobox can't work
    By gs_user in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 02, 2012, 7:26 AM
  2. Problems with linked combobox/superboxselect
    By wilbur60 in forum 1.x Help
    Replies: 0
    Last Post: Feb 25, 2011, 8:34 PM
  3. ajax linked combobox
    By studentdev in forum 1.x Help
    Replies: 1
    Last Post: Feb 05, 2010, 5:03 AM
  4. Problem With Ajax Linked ComboBox
    By sachin.munot in forum 1.x Help
    Replies: 11
    Last Post: Sep 10, 2009, 5:22 PM
  5. Linked ComboBox
    By gargamel4670 in forum 1.x Help
    Replies: 3
    Last Post: Mar 05, 2009, 3:29 PM

Posting Permissions