468,539 Members | 1,856 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,539 developers. It's quick & easy.

How to bind multi value field to DropDownList

I have a field named sList in a Sql Server database table. The field has multiple delimited values (delimited with "|"). Example could be "1|2|3|4|5". I have a view with several fields (including sList) to which I am binding to a DataList. I have defined two controls in the ItemTemplate of the Datalist, but I would like to have the last control be some kind of list control (DropDown preferably) which shows all of the values in the sList field. Any help would be appreciated.
Aug 18 '08 #1
2 2636
cloud255
427 Expert 256MB
Hi,

Do you want to show one record at a time in the drop down list?
For example "1|2|3|4|5|" is what should be shown in the combo box?

For this you simply set your sList object to be the display value of the combo box.

Or do you want each value to be a seperate entry in the combo box?

for this you would need to do string manipulation and split the string based on the delimiters and assing each value as a different item to the combo box.
Aug 19 '08 #2
Hi,

Do you want to show one record at a time in the drop down list?
For example "1|2|3|4|5|" is what should be shown in the combo box?

For this you simply set your sList object to be the display value of the combo box.

Or do you want each value to be a seperate entry in the combo box?

for this you would need to do string manipulation and split the string based on the delimiters and assing each value as a different item to the combo box.
Cloud, thanks for the reply. I want to show each delimited string as one entry in the DropDownList. I am using <% # DataBinder.Eval ...> in the ASP.NET, and I know how to do a String.Split, but do not know how to do it inline with the Eval statement.
Aug 19 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Carlos | last post: by
reply views Thread by teclioness | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.