.replace for linefeeds?

Discussion in 'ASP .Net' started by Grant Mills, May 14, 2004.

  1. Grant Mills

    Grant Mills Guest

    I'm trying to get linefeeds to display correctly in a datagrid (text is
    taken from a database of text that has been htmlencoded)

    By default it doesn't display them. But <br/> tags display fine.


    however, when I do

    validated.Replace(vbCrLf, "<br/>")

    or

    validated.Replace(chr(10), "<br/>")

    or

    validated.Replace(chr(13), "<")

    or even a function with this

    While (posistion < validated.Length And posistion > -1)

    posistion = validated.IndexOf(vbcrlf, posistion) (tried the other
    combinations)

    If posistion = -1 Then


    Exit While

    End If

    validated.Remove(posistion, 1)

    validated.Insert(posistion, "<br/>")

    posistion = posistion + 5

    End While





    None of that seems to remove and replace at all.. can anyone suggest what I
    can do?
    Grant Mills, May 14, 2004
    #1
    1. Advertising

  2. Grant Mills

    martin Guest

    Can you wrap the html text in <pre></pre> tags....

    HTH

    MarTin..


    "Grant Mills" <> wrote in message
    news:MVVoc.5037$j6.3655@edtnps84...
    > I'm trying to get linefeeds to display correctly in a datagrid (text is
    > taken from a database of text that has been htmlencoded)
    >
    > By default it doesn't display them. But <br/> tags display fine.
    >
    >
    > however, when I do
    >
    > validated.Replace(vbCrLf, "<br/>")
    >
    > or
    >
    > validated.Replace(chr(10), "<br/>")
    >
    > or
    >
    > validated.Replace(chr(13), "<")
    >
    > or even a function with this
    >
    > While (posistion < validated.Length And posistion > -1)
    >
    > posistion = validated.IndexOf(vbcrlf, posistion) (tried the other
    > combinations)
    >
    > If posistion = -1 Then
    >
    >
    > Exit While
    >
    > End If
    >
    > validated.Remove(posistion, 1)
    >
    > validated.Insert(posistion, "<br/>")
    >
    > posistion = posistion + 5
    >
    > End While
    >
    >
    >
    >
    >
    > None of that seems to remove and replace at all.. can anyone suggest what

    I
    > can do?
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    martin, May 14, 2004
    #2
    1. Advertising

  3. Grant Mills

    Joe Fallon Guest

    validated.Replace(vbCrLf, "<br/>")

    I use the above technique and it works fine.

    So I can only conclude you do NOT have any vbCRLFs in your data!

    I recommend you parse it to identify what the real character is.
    --
    Joe Fallon



    "Grant Mills" <> wrote in message
    news:MVVoc.5037$j6.3655@edtnps84...
    > I'm trying to get linefeeds to display correctly in a datagrid (text is
    > taken from a database of text that has been htmlencoded)
    >
    > By default it doesn't display them. But <br/> tags display fine.
    >
    >
    > however, when I do
    >
    > validated.Replace(vbCrLf, "<br/>")
    >
    > or
    >
    > validated.Replace(chr(10), "<br/>")
    >
    > or
    >
    > validated.Replace(chr(13), "<")
    >
    > or even a function with this
    >
    > While (posistion < validated.Length And posistion > -1)
    >
    > posistion = validated.IndexOf(vbcrlf, posistion) (tried the other
    > combinations)
    >
    > If posistion = -1 Then
    >
    >
    > Exit While
    >
    > End If
    >
    > validated.Remove(posistion, 1)
    >
    > validated.Insert(posistion, "<br/>")
    >
    > posistion = posistion + 5
    >
    > End While
    >
    >
    >
    >
    >
    > None of that seems to remove and replace at all.. can anyone suggest what

    I
    > can do?
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    Joe Fallon, May 14, 2004
    #3
    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. Rocky Moore
    Replies:
    7
    Views:
    1,715
    mikeb
    Jan 14, 2004
  2. Grant Mills

    replace linefeeds in text?

    Grant Mills, May 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    472
    Andy Gaskell
    May 17, 2004
  3. Daniel Bleisteiner

    Textarea and beginning linefeeds...

    Daniel Bleisteiner, Dec 10, 2003, in forum: HTML
    Replies:
    12
    Views:
    746
    Daniel Bleisteiner
    Dec 11, 2003
  4. Steve Rainbird

    Converting linefeeds to ebcdic

    Steve Rainbird, Mar 24, 2009, in forum: Java
    Replies:
    6
    Views:
    3,373
    Steve Rainbird
    Mar 24, 2009
  5. Replies:
    3
    Views:
    86
    Tad McClellan
    Apr 14, 2007
Loading...

Share This Page