Nov 18, 2010, 2:33 PM
[CLOSED] Combobox value and text fields
Hi,
I want to store employee ID into the value field and employee name into the text field of the combobox. The combobox will be filled with data during runtime. I tried the following but it didn't seem to work. The <combobox>.SelectedItem showing the employee name value for both Text and Value field. Can someone point out what I did wrong? Thanks in advance for the help.
Dan
- Client code
I want to store employee ID into the value field and employee name into the text field of the combobox. The combobox will be filled with data during runtime. I tried the following but it didn't seem to work. The <combobox>.SelectedItem showing the employee name value for both Text and Value field. Can someone point out what I did wrong? Thanks in advance for the help.
Dan
- Client code
<ext:Store ID="Area_Store" runat="server">
<Reader>
<ext:ArrayReader ReaderID="Area">
<Fields>
<ext:RecordField Name="id" Mapping="id" />
<ext:RecordField Name="text" Mapping="text" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
<ext:ComboBox
ID="CbArea"
runat="server"
StoreID="Area_Store"
Editable="false"
DisplayField="text"
ValueField="id"
EmptyText="---Select---" OnItemSelected="CbArea_SelectedIndexChanged">
<Listeners>
<Change Handler="Area_Store.addRecord({id: 2, text: 'Area 51'});Area_Store.commitChanges();" />
</Listeners>
</ext:ComboBox>
- server-side codeArrayList areaList = iDAO.SelectAreaList();
List<object> areaData = new List<object>(areaList.Count);
foreach (System.Web.UI.WebControls.ListItem area in areaList)
{
areaData.Add(new Object[] { int.Parse(area.Value), area.Text });
}
this.Area_Store.DataSource = areaData;
this.Area_Store.DataBind();
Last edited by Daniil; Nov 22, 2010 at 11:22 PM.
Reason: [CLOSED]