Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. DropDownList remove blanks from string

DropDownList remove blanks from string

Scheduled Pinned Locked Moved ASP.NET
question
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nimua
    wrote on last edited by
    #1

    Hello, I need to form string point_number + point_name and display it in my DropDownList as text. I have a string of blanks form rezul string like this: rez = point_number + blanks.substring(0,length(blanks) - length(point_number)) + point_name Unfortunatly I saw that in DropDownList the string is displayed with only 1 blank between number and name : (( Then I replace blanks to _ and everything was allright. What I need to change in DropDownList to force it display blanks? Thank you

    D N 2 Replies Last reply
    0
    • N Nimua

      Hello, I need to form string point_number + point_name and display it in my DropDownList as text. I have a string of blanks form rezul string like this: rez = point_number + blanks.substring(0,length(blanks) - length(point_number)) + point_name Unfortunatly I saw that in DropDownList the string is displayed with only 1 blank between number and name : (( Then I replace blanks to _ and everything was allright. What I need to change in DropDownList to force it display blanks? Thank you

      D Offline
      D Offline
      DarrollWalsh
      wrote on last edited by
      #2

      If I am not mistaken this is because HTML removes any duplicate spaces. Try replacing spaces with & nbsp; to force them in there. -- modified at 17:05 Thursday 12th July, 2007

      Darroll

      P 1 Reply Last reply
      0
      • D DarrollWalsh

        If I am not mistaken this is because HTML removes any duplicate spaces. Try replacing spaces with & nbsp; to force them in there. -- modified at 17:05 Thursday 12th July, 2007

        Darroll

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        Ok - I'll edit it for you. He needs to put   in.

        Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.

        N 1 Reply Last reply
        0
        • P Pete OHanlon

          Ok - I'll edit it for you. He needs to put   in.

          Please visit http://www.readytogiveup.com/ and do something special today. Deja View - the feeling that you've seen this post before.

          N Offline
          N Offline
          Nimua
          wrote on last edited by
          #4

          Hello, Thank you for answers but I tryied to replace blanks with   but it displayed like this 123    Name : (( Here is my code: On DropDownListDataBound for (int i = 0; i < DDListPoint.Items.Count; i++) { DDListPoint.Items[i].Text = DDListPoint.Items[i].Text.Replace(" ", " "); } When I should replace blanks? on the client side in Javascript? Thank you : )

          N 1 Reply Last reply
          0
          • N Nimua

            Hello, Thank you for answers but I tryied to replace blanks with   but it displayed like this 123    Name : (( Here is my code: On DropDownListDataBound for (int i = 0; i < DDListPoint.Items.Count; i++) { DDListPoint.Items[i].Text = DDListPoint.Items[i].Text.Replace(" ", " "); } When I should replace blanks? on the client side in Javascript? Thank you : )

            N Offline
            N Offline
            Nimua
            wrote on last edited by
            #5

            Oops : ) second string in Replace is  

            N 1 Reply Last reply
            0
            • N Nimua

              Oops : ) second string in Replace is  

              N Offline
              N Offline
              Nimua
              wrote on last edited by
              #6

              Hello, May be somebody knows another way to solve the problem, is there columns in DropDownList or anything else to apart data?

              1 Reply Last reply
              0
              • N Nimua

                Hello, I need to form string point_number + point_name and display it in my DropDownList as text. I have a string of blanks form rezul string like this: rez = point_number + blanks.substring(0,length(blanks) - length(point_number)) + point_name Unfortunatly I saw that in DropDownList the string is displayed with only 1 blank between number and name : (( Then I replace blanks to _ and everything was allright. What I need to change in DropDownList to force it display blanks? Thank you

                N Offline
                N Offline
                Nimua
                wrote on last edited by
                #7

                Hello, I find solution to my problem : ) string blanks = HttpUtility.HtmlDecode("     &nbsp "); rez = point_number + blanks.substring(0,length(blanks) - length(point_number)) + point_name

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups