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 8076397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:15:11+00:00 2026-06-05T15:15:11+00:00

I have a dropdownlist that has the value of two columns in it… One

  • 0

I have a dropdownlist that has the value of two columns in it… One column is a number ranging from 5 characters long to 8 characters long then a space then the ‘|’ character and another space, followed by a Description for the set of numbers.

An example:

12345678 | Description of Product 

In order to pull the items for the dropdownlist into my database I need a to utilize a substring to pull the sequence of numbers out only.

Is it possible to write a substring to pull multiple character lengths? (Sometimes it may be 6 numbers, sometimes 5 numbers, sometimes 8, it would depend on what the user selected from the dropdownlist.)

  • 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-05T15:15:12+00:00Added an answer on June 5, 2026 at 3:15 pm

    Use a regular expression for this.

    Assuming the number is at the start of the string, you can use the following:

    ^[0-9]+
    

    Usage:

    var theNumbers = RegEx.Match(myDropdownValue, "^[0-9]+").Value;
    

    You could also use string.Split to get the parts separated by | if you know the first part is what you need and will always be numeric:

    var theNumbers = myDropdownValue.Split("| ".ToCharArray(), 
                                           StringSplitOptions.RemoveEmptyEntries)[0];
    

    Either of these approaches will result in a string. You can use int.Parse on the result in order to get an integer from it.

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

Sidebar

Related Questions

I have dropdownlist,which get filled from table1.That table1 has Zero value.While filling the dropdown,want
I have a dropdownlist that has 4 columns but only 3 are 'visible' the
I have a WebForms page that has two DropDownList controls on it that both
I have two tables, Job and Client. Job has a column, ClientId, that is
i have a dropdownlist that populates from the sql server database. populating the list
I have an ASP.NET DropDownList control that retrieves the first and last name from
I have a dropdownlist inside a gridview, that is loaded from a datasource when
I have an ASP.NET GridView that has four columns. The first three are typical
I have a DropDownList populated with a SelectList generated from (an anonymous type) that
I have a DropDownList inside a repeater control in an ASP.NET page that has

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.