Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8588423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:47:56+00:00 2026-06-11T22:47:56+00:00

I want to populate a dropdownlist with comma seperated values from a textbox. I

  • 0

I want to populate a dropdownlist with comma seperated values from a textbox. I have below code:

sDDvalues = txtValues.Text

Me.DropDownList1.Items.Clear()
Dim months() As String = {sDDvalues}
Me.DropDownList1.DataSource = months
Me.DropDownList1.DataBind()

I have entered in the textbox like: value1, value2 and “value1”, “value2” and ‘value1′,’value2’, but every combination is returned as 1 option:

<option value="'value1', 'value2'">'value1', 'value2'</option>

Entering the actual values for months() like: {“value1”, “value2”} returns a correct dropdown:

<option value="value1">value1</option>
<option value="value2">value2</option>

Does anyone know how to solve this, so it populates from the values in the textbox?

Thanks in advance!

Marcellino

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:47:57+00:00Added an answer on June 11, 2026 at 10:47 pm

    It should be:

    Me.DropDownList1.DataSource = txtValues.Text.Split(New Char() {" "c, "-"c})
    

    So completed:

    Me.DropDownList1.Items.Clear()
    Me.DropDownList1.DataSource = txtValues.Text.Split(New Char() {" "c, "-"c})
    Me.DropDownList1.DataBind()
    

    Input in the textbox would be like: value1 value2 value3

    If you wanted to have it split at a comma then use:

    Me.DropDownList1.DataSource = txtValues.Text.Split(",")
    

    Input in the textbox would be like: this is my value1, this is my value2, this is my value3

    Thanks for the responses!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i m using following code to populate dropdownlist dynamically... i want that value should
I have a dropdownlist that I want to populate with a specific value and
I have a DropDownList as a TemplateField in a DetailsView. I want to populate
I have to 2 dropdownlists and I want to populate them with their values
I want to populate a table form a MYSQL database. I have defined the
I want to populate GridView below with images: <asp:GridView ID=GrdDynamic runat=server AutoGenerateColumns=False> <Columns> </Columns>
I want to populate a drop down menu with a column from a MySQL
I want to populate database with Cyrillic text namespace :db do task :populate =>
I have the following database schema: Here's how I populate a DropDownList in my
Hi i have an excel sheet with headers,i want to populate those headers into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.