asp/net Drop Down List

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a driop down list control on a web form. I am filling it using the following code:

public void BindSystemCodeList()
{
sysCodeList.DataTextField = "Value";
sysCodeList.DataValueField = "Value";
sysCodeList.DataSource = CreateSystemCodeListDataSource();
sysCodeList.DataBind();
}

In addition to the "Value" field, I would like to include the "Valdesc" field

Does anyone have any idea how I can do that.

Thanks,

dave
 
you can't do it this way. an alternative would be to manually loop thru the
datasource and manually add the items with each pass. For the value field
you would concatenate them with separating character for the value field.
When you need the information back you can just split on the separating
character

for loop
sysCodeList.items[index].text = "text here"
sysCodeList.items[index].value = Value + "#" + Valdesc;

[snip] to retrieve
for loop
string[] str = sysCodeList.items[index].value.tostring().split('#')
 
Back
Top