Multiple value under a single dropdownlist item
-
Hi all, I am using C#.NET 2005. SQL Server 2005. Is that possible to have a multiple datavaluefield in dropdownlist? Normally i am using ddl.selectedValue to get value for that selected item. So, can i get 2 or more value under a item? any suggestions are welcome:) thanks in advance. regards cocoonwls
-
Hi all, I am using C#.NET 2005. SQL Server 2005. Is that possible to have a multiple datavaluefield in dropdownlist? Normally i am using ddl.selectedValue to get value for that selected item. So, can i get 2 or more value under a item? any suggestions are welcome:) thanks in advance. regards cocoonwls
No. Actually there must be only one Value for each Dropdown option. Also the DataValueField will be unique. If you want to create such thing, you need to use your own dropdownlist. :(
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
Hi all, I am using C#.NET 2005. SQL Server 2005. Is that possible to have a multiple datavaluefield in dropdownlist? Normally i am using ddl.selectedValue to get value for that selected item. So, can i get 2 or more value under a item? any suggestions are welcome:) thanks in advance. regards cocoonwls
you can do this by adding a custom data field to the data source having value as concatenation of the two or more fields that you wanna use as DataValueField. Then again process/manipulate this value while retrieving the SelectedValue of the dropdown list.
-
you can do this by adding a custom data field to the data source having value as concatenation of the two or more fields that you wanna use as DataValueField. Then again process/manipulate this value while retrieving the SelectedValue of the dropdown list.
Hi, Thanks for both of your kindly help. I have found a solution. I am using concatenation in query and put in the DataValueField.Then retrive it by ddl.selectedValue.split() to get the value in string array. Here is the example:
Query = Select (fieldA + ',' + fieldB) as Result From Table1
Set DataValueField to Result.
Then, set String[] aResult = ddl.selectedValue.split(',')
Finally get value from aResult[i].Thank you :laugh: regards cocoonwls