[CLOSED] ComboBox added values are not showing.

  1. #1

    [CLOSED] ComboBox added values are not showing.

    Hi,

    I have created 2 forms one is main form and other one is popup window. While open popup window from main window, I have to select top drop down list. Based on selected value the combobox values need to populate. These comboboxes are inside composite-field which is initially hidden. After loading comboboxes those are not showing any items. Here is the code for main window and popup window...

    Main window...
    <%@ 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">
    
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script language="javascript" type="text/javascript">
            var OpenPanelInfo = function (pnlInfo, defVal) {
                var windowConfig = {
                    id: "WindowPopup",
                    height: 528,
                    width: 720,
                    hidden: false,
                    closeAction: "hide",
                    buttonAlign: "center",
                    iconCls: "icon-pagewhitecode",
                    buttons: [
                        {
                            id: "btnWinPipeLineClose",
                            text: "Close",
                            listeners: {
                                click: {
                                    fn: function (el, e) {                                   
                                        parent.parent.Ext.getCmp('WindowPopup').hide();
                                    }
                                }
                            }
                        }
                    ],
                    autoLoad: {
                        url: "ExtRender2.aspx?" + new Date().getTime(),
                        nocache: true,
                        mode: "iframe",
                        showMask: true,
                        triggerEvent: "show",
                        reloadOnEvent: true,
                        params: {
                            DEFAULT_PANEL_OPEN: pnlInfo,
                            DEFAULT_VALUE: defVal
                        }
                    }
                }
                renderWindow(windowConfig);
            }
    
            var renderWindow = function (windowConfig) {
                var win = Ext.getCmp(windowConfig.id);
                if (!win) {
                    new Ext.Window(windowConfig);
                } else {
                    win.close();
                    new Ext.Window(windowConfig);
                }
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="resMngr" runat="server" />
        <ext:Viewport ID="Viewport1" runat="server">
            <Items>
                <ext:Button ID="btnWithMenu" runat="server" Icon="Cog" Text="Options">
                    <Menu>
                        <ext:Menu ID="Menu1" runat="server">
                            <Items>
                                <ext:MenuItem runat="server" Text="Open Panel1" ID="lnDelete">
                                <Listeners>
                                <Click Handler="OpenPanelInfo('0','0')" />
                                </Listeners>
                                </ext:MenuItem>
                                <ext:MenuItem runat="server" Text="Open Panel2 with 0" ID="lnExport">
                                <Listeners>
                                <Click Handler="OpenPanelInfo('1','0')" />
                                </Listeners>
                                </ext:MenuItem>
                            </Items>
                        </ext:Menu>
                    </Menu>
                </ext:Button>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
    Popup window code...(ExtRender2.aspx)
    <%@ 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)
        {
            int pnlNum = 0;
            if (!Page.IsPostBack)
            {
                LoadReqNumbers();
                if (Request.QueryString["DEFAULT_PANEL_OPEN"] != null)
                {
                    pnlNum = Convert.ToInt32(Request.QueryString["DEFAULT_PANEL_OPEN"]);
                }
                pnlbackground.ActiveIndex = pnlNum;
    
                if (Request.QueryString["DEFAULT_VALUE"] != null)
                {
                    pnlNum = Convert.ToInt32(Request.QueryString["DEFAULT_VALUE"]);
                    if (pnlNum == 0)
                    {
                        Ext.Net.X.Msg.Alert("Select Number", "You need to select a number", "ddlstStatus.onTriggerClick()").Show();
                    }
                }
            }
        }
    
        public void LoadReqNumbers()
        {
            ddlstStatus.Items.Add(new Ext.Net.ListItem("Load 1 value", "1"));
            ddlstStatus.Items.Add(new Ext.Net.ListItem("Load 2 values", "2"));
            ddlstStatus.Items.Add(new Ext.Net.ListItem("Load 3 values", "3"));
            ddlstStatus.Items.Add(new Ext.Net.ListItem("Load 4 values", "4"));
        }
        
        
    
        public void ShowPanel1Info(object sender, DirectEventArgs e)
        {
            pnlbackground.ActiveIndex = 0;
        }
    
        public void ShowPanel2Info(object sender, DirectEventArgs e)
        {
            pnlbackground.ActiveIndex = 1;
        }
    
        public void ddlstStatus_SelectedIndexChanged(object sender, DirectEventArgs e)
        {        
            for(int i=0; i<Convert.ToInt32(ddlstStatus.SelectedItem.Value);i++)
            {
                cboCondition0.Items.Add(new Ext.Net.ListItem("Condition " + i.ToString(), i.ToString()));
                cboCondition1.Items.Add(new Ext.Net.ListItem("Condition " + i.ToString(), i.ToString()));
            }
    
            ComFld0.Show();
            ComFld1.Show();
            
        }
        
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="resMngr" runat="server">
        </ext:ResourceManager>
        <ext:Viewport ID="Viewport1" runat="server" Layout="Border">
            <Items>
                <ext:Panel ID="pnlbackground" runat="server" Region="Center" Border="false" Layout="CardLayout">
                    <TopBar>
                        <ext:Toolbar ID="tbTest" runat="server">
                            <Items>
                                <ext:Button ID="btnPnl1" runat="server" Text="Load Panel1">
                                    <DirectEvents>
                                        <Click OnEvent="ShowPanel1Info" />
                                    </DirectEvents>
                                </ext:Button>
                                <ext:ToolbarSeparator />
                                <ext:Button ID="btnPnl2" runat="server" Text="Load Panel2">
                                    <DirectEvents>
                                        <Click OnEvent="ShowPanel2Info" />
                                    </DirectEvents>
                                </ext:Button>
                                <ext:ToolbarFill />
                                <ext:ComboBox ID="ddlstStatus" runat="server" Width="150">
                                            <DirectEvents>
                                                <Select OnEvent="ddlstStatus_SelectedIndexChanged">
                                                </Select>
                                            </DirectEvents>
                                        </ext:ComboBox>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <Items>
                        <ext:Panel ID="pnl1" runat="server" Border="true" html = "Panel1 info" Region="Center" BodyStyle="background-color:#ffffff">
                            <Items>
                            </Items>
                        </ext:Panel>
                        <ext:FormPanel ID="pnl2" runat="server" Border="false" Region="Center" Layout="BorderLayout"
                            BodyStyle="background-color:#ffffff" HideMode="Offsets">
                            <Items>
                                <ext:Panel ID="pnlBrowse" runat="server" Region="North" Height="98" Margins="5,5,5,5"
                                    BodyStyle="background-color:#ededed">
                                    <TopBar>
                                        <ext:Toolbar ID="tbDocs" runat="server" Height="28">
                                            <Items>
                                                <ext:ToolbarFill />
                                                <ext:Label ID="lblFileNameInfo" runat="server" Text="">
                                                </ext:Label>
                                                <ext:ToolbarSpacer />
                                                <ext:ToolbarSpacer />
                                                <ext:ToolbarSpacer />
                                                <ext:Label ID="lblUploadPercent" runat="server" Text="" StyleSpec="color:green;font-size:10pt;font-family:Arial">
                                                </ext:Label>
                                            </Items>
                                        </ext:Toolbar>
                                    </TopBar>
                                    <Items>
                                        <ext:Container ID="dropZone" runat="server" Region="Center" Layout="Absolute">
                                            <Items>
                                                <ext:Label ID="lblDropHere" runat="server" Text="Drop File Here" X="295" Y="2" StyleSpec="font-size:10pt;font-family:Arial">
                                                </ext:Label>
                                                <ext:Label ID="lblOr" runat="server" Text="or" X="330" Y="20" StyleSpec="font-size:8pt;font-family:Arial">
                                                </ext:Label>
                                                <ext:FileUploadField ID="FileUploadField1" runat="server" ButtonText="Browse To Upload"
                                                    Icon="Add" ButtonOnly="true" AllowBlank="false" X="280" Y="30">
                                                    <%--<Listeners>
                                                        <Render Handler="SetMultipleUpload(this) ;" />
                                                        <FileSelected Handler="if(!UpdateUploadInfo(this.fileInput.dom)) {this.reset();SetMultipleUpload(this)};" />
                                                    </Listeners>--%>
                                                </ext:FileUploadField>
                                                <ext:Label ID="lblMsg" runat="server" Text="(hold Ctrl key to select multiple files)"
                                                    X="400" Y="40" StyleSpec="font-size:8pt;font-family:Arial">
                                                </ext:Label>
                                            </Items>
                                        </ext:Container>
                                    </Items>
                                </ext:Panel>
                                <ext:FormPanel ID="FormPanel1" runat="server" BodyStyle="background-color:#ffffff;"
                                    Region="Center" Margins="5,5,5,5" Layout="BorderLayout">
                                    <Items>                                    
                                        <ext:FormPanel ID="pnlFilesInfo" runat="server" Region="Center" Padding="3" Border="false"
                                            AutoScroll="true">
                                            <Items> 
                                            <ext:CompositeField ID="ComFld0" runat="server" AnchorHorizontal="95%" HideLabel="true"
                                                    Hidden="true">
                                                    <Items>
                                                        <ext:ComboBox ID="cboCondition0" runat="server" Flex="12" Editable="true" ForceSelection="false"
                                                            EmptyText="Enter Condition">
                                                        </ext:ComboBox>
                                                        <ext:Label ID="lblFileName0" runat="server" Flex="15" Text="">
                                                        </ext:Label>
                                                        <ext:Label ID="lblFileSize0" runat="server" Flex="3" Text="">
                                                        </ext:Label>
                                                        <ext:TextField ID="txtFName0" runat="server" Flex="1" Text="" Hidden="true">
                                                        </ext:TextField>
                                                    </Items>
                                                </ext:CompositeField>
                                                <ext:CompositeField ID="ComFld1" runat="server" AnchorHorizontal="95%" HideLabel="true"
                                                    Hidden="true">
                                                    <Items>
                                                        <ext:ComboBox ID="cboCondition1" runat="server" Flex="12" Editable="true" ForceSelection="false"
                                                            EmptyText="Enter Condition">
                                                        </ext:ComboBox>
                                                        <ext:Label ID="lblFileName1" runat="server" Flex="15" Text="">
                                                        </ext:Label>
                                                        <ext:Label ID="lblFileSize1" runat="server" Flex="3" Text="">
                                                        </ext:Label>
                                                        <ext:TextField ID="txtFName1" runat="server" Flex="1" Text="" Hidden="true">
                                                        </ext:TextField>
                                                    </Items>
                                                </ext:CompositeField>                                           
                                            </Items>
                                        </ext:FormPanel>
                                    </Items>
                                </ext:FormPanel>
                            </Items>
                        </ext:FormPanel>
                    </Items>
                </ext:Panel>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
    Last edited by Daniil; Mar 29, 2013 at 1:50 PM. Reason: [CLOSED]
  2. #2
    Hello!

    Try to change ddlstStatus_SelectedIndexChanged to the following:

    public void ddlstStatus_SelectedIndexChanged(object sender, DirectEventArgs e)
    {        
    	for(int i=0; i<Convert.ToInt32(ddlstStatus.SelectedItem.Value);i++)
    	{
    		cboCondition0.AddItem("Condition " + i.ToString(), i.ToString());
    		cboCondition1.AddItem("Condition " + i.ToString(), i.ToString());
    	}
    
    	ComFld0.Show();
    	ComFld1.Show();
    }
    The main reason is that during DirectEvent you should use method not properties.
  3. #3
    Hi Baidaly,

    Thank you it is working. You can close this.

Similar Threads

  1. Replies: 1
    Last Post: Mar 29, 2012, 11:42 PM
  2. Replies: 2
    Last Post: Oct 11, 2011, 2:15 PM
  3. Replies: 3
    Last Post: Jun 03, 2011, 1:10 PM
  4. Replies: 5
    Last Post: Aug 02, 2010, 1:30 PM

Tags for this Thread

Posting Permissions