Re: ASP.NET TextBox

Discussion in 'ASP .Net' started by Garett Rogers, May 5, 2004.

  1. a small workaround that you can try would be to add an extra carriage return
    at the beginning of the textbox if one exists already... if you do a little
    experiment, adding 2 carriage returns and some text will produce one blank
    line, 3 will produce 2, 4 will produce 3, etc.

    So here's my solution... In the page load do the following:

    TextBox1.Text = IIf(TextBox1.Text.IndexOf(vbCrLf) = 0,vbCrLf &
    TextBox1.Text,TextBox1.Text)

    Hope this helps,
    Garett

    http://www.aimx.com
    There's no place like 127.0.0.1


    "Oliver" <> wrote in message
    news:...
    > I hope some can help me with a slight problem.
    >
    > I have a form with a multi-line text box. The problem I have is when the

    user enters a carriage return followed by some text, the form is posted back
    and the value of text box is correct. It includes the leading carriage
    return.
    >
    > However, when the textbox is redisplayed on the client, any leading

    carriage returns are lost and need to re-entered each time.
    >
    > Any ideas?
    >
    > Thanks
    >
    > Oliver
     
    Garett Rogers, May 5, 2004
    #1
    1. Advertising

  2. Thanks guys

    Using a slightly modified version of your sugguestion Garett, I was able to get it to work. Instead of prefixing the text with an additional CR I used a space. Thus avoiding the need to calcalate the number of additional CRs required

    TextBox1.Text = IIf( TextBox1.Text.IndexOf(vbCrLf) = 0, Format("_{0}",TextBox1.Text), TextBox1.Text
     
    =?Utf-8?B?T2xpdmVy?=, May 6, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q2hyaXM=?=
    Replies:
    3
    Views:
    13,783
    Peter Blum
    Mar 30, 2005
  2. Imran Aziz
    Replies:
    2
    Views:
    11,470
    Imran Aziz
    Sep 5, 2005
  3. ald
    Replies:
    3
    Views:
    181
    Axel Dahmen
    Dec 21, 2003
  4. ErwinP
    Replies:
    1
    Views:
    748
    ErwinP
    Aug 19, 2005
  5. Steve
    Replies:
    4
    Views:
    215
    Steve
    Feb 7, 2006
Loading...

Share This Page