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. Text Wrap

Text Wrap

Scheduled Pinned Locked Moved ASP.NET
helpsysadminquestion
3 Posts 2 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.
  • T Offline
    T Offline
    Toni78
    wrote on last edited by
    #1

    I was wondering if someone could help me with this problem that I have. I have a TextBox with multiple lines and automatic text wrap. After I get the text I save it in a variable and later on when the user moves to a new page I display the text by using <pre> formatting. I display the text on a predefined label. asp:Label id=mylabel runat=server Sub Page_Load(...) mylabel.txt = some_string_I_have_saved End Sub The problem is that for large blocks of text (by large I mean 500 characters) the text doesn't wrap. I have to scroll left and right and that's not desirable. I tried to solve this problem by inserting vbCrLf every 80 characters or so but is there a different way? Thank you. Time is the fire in which we burn.

    T 1 Reply Last reply
    0
    • T Toni78

      I was wondering if someone could help me with this problem that I have. I have a TextBox with multiple lines and automatic text wrap. After I get the text I save it in a variable and later on when the user moves to a new page I display the text by using <pre> formatting. I display the text on a predefined label. asp:Label id=mylabel runat=server Sub Page_Load(...) mylabel.txt = some_string_I_have_saved End Sub The problem is that for large blocks of text (by large I mean 500 characters) the text doesn't wrap. I have to scroll left and right and that's not desirable. I tried to solve this problem by inserting vbCrLf every 80 characters or so but is there a different way? Thank you. Time is the fire in which we burn.

      T Offline
      T Offline
      Tomas Petricek
      wrote on last edited by
      #2

      Hi, I don't understand why you decided to use <pre> tag.. Because text inside this tag is not wrapped automatically. You should use pre tag when you want to display text "as is" (for example source code). But if you want browser to wrap text <div> is better :). If you want to display it using same font as pre tag you can write something like this:

      <div style="font:100% 'courier new',monospace">
      .. your text ..
      </div>

      Tomas Petricek (Microsoft C# MVP)
      www.eeeksoft.net | Photos | ASP.NET Multi-column layout control

      T 1 Reply Last reply
      0
      • T Tomas Petricek

        Hi, I don't understand why you decided to use <pre> tag.. Because text inside this tag is not wrapped automatically. You should use pre tag when you want to display text "as is" (for example source code). But if you want browser to wrap text <div> is better :). If you want to display it using same font as pre tag you can write something like this:

        <div style="font:100% 'courier new',monospace">
        .. your text ..
        </div>

        Tomas Petricek (Microsoft C# MVP)
        www.eeeksoft.net | Photos | ASP.NET Multi-column layout control

        T Offline
        T Offline
        Toni78
        wrote on last edited by
        #3

        Thank you very much for your reply Tomas. You see, I am a beginner when it comes to ASP.NET and website applications in general (I come from a c/c++ background), therefore <pre> seemed like an "excellent" solution to me. I never fully understood <div> so I will have to read some more about it. Once again, thank you very much for your help. Time is the fire in which we burn.

        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