Hi,
Hi can I store some hidden value like primary key of an item with a combobox.
Like in ASP.NET the DropDownList has DataTextField and DataValueField for text and value.
I am adding item to ComboBox like this :
cmbBrowseCombo.Items.Add("item1");
cmbBrowseCombo.Items.Add("item2");
How can i add a hidden value to each Item....
If possible do reply...
thank you...
Basu BiswasPosted Jan 31, 2007, 8:36 AM
kanika gaubaPosted Jan 31, 2007, 6:03 AM
As you have also speciied DataTextField and DataValueFiled
DataTextField is the value which we can see in a drop down.
DataValueField is the value which stated the value that can be stored behind the drop down each item.
You can bind the dataset with the dataSource like
DropDown.DataSource=DataTable;
Dropdown.DataTextField=DataTable["Primary_Key"];
Dropdown.DataValueField=DataTable["Item_Value"];
DropDown.DataBind();
You can the each item value as well as the text later.