PDA

View Full Version : [CLOSED] Combobox can't get value when add list item using code behind



opacjkt
Oct 20, 2015, 7:41 AM
This code for insert value into cboRegional


public List<PropertyFinance> obj = PropertyFinanceItemItem.GetDataAll();
protected void Page_Load(object sender, EventArgs e)
{

if (!X.IsAjaxRequest)
{
List<Ext.Net.ListItem> licol = new List<Ext.Net.ListItem>();
var cboObj = obj.Select(x => x.KODE_REGIONAL).Distinct().OrderBy(x => x);

foreach (var item in cboObj)
{
licol.Add(new Ext.Net.ListItem(item, item));
}
licol.Insert(0, new Ext.Net.ListItem("All", "All"));
cboRegional.Items.AddRange(licol);
cboRegional.Value = "All";
}

}
protected void GHRefresh(object sender, StoreReadDataEventArgs e)
{
string xyz = this.cboRegional.SelectedItem.Text; // result = null
xyz = this.cboRegional.Text; // result =''
}

how to get value string of cboRegional?

thanks

Daniil
Oct 20, 2015, 3:02 PM
Hi @opacjkt,

Please provide a full test case to reproduce the issue

Meanwhile, is there a <form runat="server"> on the page?

opacjkt
Oct 21, 2015, 3:56 AM
Thanks problem fix, because iam not entered <ext:FormPanel ID="frmpnl" runat="server">