Hi - please help.
ASP.NET/C#
I am trying to add more information into the ListItems of a DropdownList. Unfortunately, I cannot add an object to the Dropdownlist (unlike in Windows Forms), so I am trying to add the extra values as attributes, like this.
This goes through without error, but I cannot later reference this attribute to find the address for the selected item in the dropdownlist.
How can I do this?
Many thanks
BB
ASP.NET/C#
I am trying to add more information into the ListItems of a DropdownList. Unfortunately, I cannot add an object to the Dropdownlist (unlike in Windows Forms), so I am trying to add the extra values as attributes, like this.
ListItem liName = new ListItem();
liName.Text = "Peter Pan";
liName.Value = "100";
liName.Attribut es.Add("Address ", "Neverland" );
ddlNames.Items. Add(liName);
liName.Text = "Peter Pan";
liName.Value = "100";
liName.Attribut es.Add("Address ", "Neverland" );
ddlNames.Items. Add(liName);
This goes through without error, but I cannot later reference this attribute to find the address for the selected item in the dropdownlist.
How can I do this?
Many thanks
BB