May 06, 2015, 10:10 AM
[CLOSED] ComboBox selected item not working
Hi, my problem is that my ComboBox not show selected value.
.aspx page
where i make mistake?
Thank!
.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>
.csint _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 jsvar 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]