Allow White Spaces between Words

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raghulvarma
    New Member
    • Oct 2007
    • 90

    Allow White Spaces between Words

    Hi,
    I am using asp.net 1.x, Here i will have to store the values in the database along with the white spaces
    for eg: "My New Thread"
    here I have given spaces between these words (could not be seen in the preview as it takes only one spacing between each word) but when i save them or try to display them in a Label or in a grid the spaces between them are reduced and only one space is shown between each words how to solve this?
    Another question is, is that possible to have blank spaces at the end of a word for eg: "Threading " (could not be seen in the preview as it takes only one spacing between each word), if so is it possible to show as I have given in this example in the grid by databinder.Eval (Container.Data Item, "firstName" )
    ie:
    Code:
    <asp:Label id="label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "firstName") %></asp:Label>
    because eval trims the blank spaces!!

    Regards
    Raghul
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    In ASP.NET all of the content displayed to the user is done so using HTML. In HTML white space is ignored....in order to print more than one space between words you have to use the HTML &nbsp; entity.

    Since you are displaying data that is bound to item, you're going to have to figure out a way to get replace the spaces in the string with &nbsp; entities....sou nds like fun

    -Frinny

    Comment

    Working...