Space between two words is removed while displaying on lebel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kharedeepak
    New Member
    • Jun 2007
    • 1

    Space between two words is removed while displaying on lebel

    I have form in which I have an asp.net Textbox and Level.
    I am saving data with spaces (e.g. test test) and when I retreive this data from database and display the same on the level it removes spaces between the words and shows result like (test test).
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Welcome to the site. I don't see the difference between the two results.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Originally posted by kharedeepak
      I have form in which I have an asp.net Textbox and Level.
      I am saving data with spaces (e.g. test test) and when I retreive this data from database and display the same on the level it removes spaces between the words and shows result like (test test).
      This could possibly be because HTML ignores whitespace...

      Comment

      • nateraaaa
        Recognized Expert Contributor
        • May 2007
        • 664

        #4
        Originally posted by Frinavale
        This could possibly be because HTML ignores whitespace...
        Before saving your data to the database try doing a string.Replace and replace a space with &nbsp.

        string.Replace( " ", "&nbsp");

        Nathan

        Comment

        • radcaesar
          Recognized Expert Contributor
          • Sep 2006
          • 759

          #5
          I was not clear on the question ? It looks string has space between them (May be like he types)

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by radcaesar
            I was not clear on the question ? It looks string has space between them (May be like he types)
            The reason you can't see the difference between them is because HTML ignores white space...you will see the difference when you reply to the question.

            Comment

            • radcaesar
              Recognized Expert Contributor
              • Sep 2006
              • 759

              #7
              Originally posted by kharedeepak
              I have form in which I have an asp.net Textbox and Level.
              I am saving data with spaces (e.g. test test) and when I retreive this data from database and display the same on the level it removes spaces between the words and shows result like (test test).

              Hey here is the solution

              http://www.w3.org/TR/REC-CSS2/text.html

              :)

              Comment

              Working...