[CLOSED] ComboBox selected item not working

  1. #1

    [CLOSED] ComboBox selected item not working

    Hi, my problem is that my ComboBox not show selected value.

    .aspx page
    <ext:FormPanel ID="frm_recapito" runat="server" Layout="FormLayout" BodyPadding="10">
            <Items>
                <ext:ComboBox runat="server" ID="idtipoaltrorecapito" ValueField="IDTipoAltroRecapito" DisplayField="Descrizione" FieldLabel="Tipo" QueryMode="Local" ForceSelection="true" AllowBlank="false" TriggerAction="All">
                    <Store>
                        <ext:Store runat="server" ID="store_altri_recapiti">
                            <Model>
                                <ext:Model runat="server" IDProperty="IDTipoAltroRecapito" ID="mod1">
                                    <Fields>
                                        <ext:ModelField Name="IDTipoAltroRecapito" />
                                        <ext:ModelField Name="Descrizione" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                            
                        </ext:Store>
                    </Store>
                </ext:ComboBox>
                <ext:TextField ID="valore" runat="server" EmptyText="Inserisci un valore" FieldLabel="Valore" AllowBlank="false" />
                <ext:TextArea ID="note" runat="server" EmptyText="Note..." FieldLabel="Note" />
            </Items>
            <Buttons>
                <ext:Button runat="server" Text="Modifica" Icon="Pencil">
                    <DirectEvents>
                        <Click OnEvent="Salva" />
                    </DirectEvents>
                </ext:Button>
            </Buttons>
        </ext:FormPanel>
    .cs
    int _id = (Request.QueryString["id"] != null) ? Int32.Parse(Request.QueryString["id"]) : 0;
            using (PF3ModelContainer db = new PF3ModelContainer())
            {
                Store store = idtipoaltrorecapito.GetStore();
                var el = (from s in db.ListaTipiAltriRecapiti
                          select new
                          {
                              s.IDTipoAltroRecapito,
                              s.Descrizione
                          });
                store.DataSource = el;
                store.DataBind();
            }
    
            if (!X.IsAjaxRequest)
            {
                using (PF3ModelContainer db = new PF3ModelContainer())
                {
                    
    
                    vw_ContattiAltriRecapiti cr = db.vw_ContattiAltriRecapiti.Where(x => x.IDAltroRecapito == _id).SingleOrDefault();
    
                    if (cr != null)
                    {
    //this not works. i've tried other solution ex: idtipoaltrorecapito.SelectedItem.Value = 1 but it not works
                        idtipoaltrorecapito.SelectedItems.Add(new Ext.Net.ListItem { Text = cr.TipoRecapito, Value = cr.IDTipoAltroRecapito.ToString() });
    
    
    
                        valore.Text = cr.Valore;
                        note.Text = cr.Note;
                    }
    
                }
            }
    aspx file is loaded by js
    var ModificaAltriRecapiti = function (id, el, rif, idcontatto) {
        var titolo = (id > 0) ? "Modifica Recapito" : "Aggiungi Recapito";
        //var tip = Ext.create('Ext.tip.ToolTip', {
        var tip = Ext.create('Ext.Window', {
            target: el,
            id: 'win_modifica_altri_recapiti',
            title: titolo,
            closable: 'true',
            autoHide: false,
            anchor: "left",
            animate: true,
            draggable: true,
            constrain: true,
            layout: 'fit',
            modal: true,
            height: 450,
            width: 550,
            loader: {
                url: '/usercontrol/modifica_altri_recapiti.aspx',
                autoLoad: true,
                renderer: "frame", //!!//
                params: {
                    id: id,
                    idcontatto: idcontatto
                },
                loadMask: [{ msg: "Waiting...", autoShow: true }]
            }
        }).show();
    
    };

    where i make mistake?

    Thank!
    Last edited by Daniil; May 13, 2015 at 8:23 AM. Reason: [CLOSED]
  2. #2
    Hi @maurox,

    Please post the rendered JavaScript code with the ComboBox or post a full runnable test case.

Similar Threads

  1. Replies: 17
    Last Post: Dec 17, 2012, 11:58 AM
  2. ComboBox selected item
    By rookie in forum 1.x Help
    Replies: 0
    Last Post: Dec 15, 2012, 5:25 PM
  3. [CLOSED] Always selected Item is nothing for combobox as menu item
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 04, 2011, 4:51 PM
  4. Get Combobox Selected item
    By yarlenvas in forum 1.x Help
    Replies: 3
    Last Post: Mar 08, 2009, 2:04 PM
  5. Get ComboBox Selected Item
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 18, 2008, 9:50 AM

Posting Permissions