Line feeds in a GridView

Discussion in 'ASP .Net' started by MSNews, Nov 4, 2006.

  1. MSNews

    MSNews Guest

    Hi,

    If a database field contains more than one line of text, i.e. Several
    Environment.NewLine characters, the GridView cell ignores them. If I replace
    the NewLine with "<br />" - the GridView helpfully converts that string to
    "&lt;br %gt;" and so I don't get the CrLf - arrgh! this used to be easy, am
    I missing a simple trick?

    The colums are autogenerated, which works perfectly except for this problem.

    Can anyone help?

    TIA
     
    MSNews, Nov 4, 2006
    #1
    1. Advertising

  2. MSNews

    MSNews Guest

    OK,

    I finally managed to dig down through the smart-tag to find the HtmlEncode
    property of the BoundField and set it to false. so, by replacing NewLine
    with "<br />" in the database, it all works.


    "MSNews" <> wrote in message
    news:...
    > Hi,
    >
    > If a database field contains more than one line of text, i.e. Several
    > Environment.NewLine characters, the GridView cell ignores them. If I
    > replace the NewLine with "<br />" - the GridView helpfully converts that
    > string to "&lt;br %gt;" and so I don't get the CrLf - arrgh! this used to
    > be easy, am I missing a simple trick?
    >
    > The colums are autogenerated, which works perfectly except for this
    > problem.
    >
    > Can anyone help?
    >
    > TIA
    >
     
    MSNews, Nov 4, 2006
    #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. Schroeder
    Replies:
    1
    Views:
    566
    Jim Gibson
    Jan 26, 2005
  2. Replies:
    2
    Views:
    3,956
  3. Patrick Olurotimi Ige
    Replies:
    2
    Views:
    511
    Patrick Olurotimi Ige
    May 5, 2005
  4. Replies:
    3
    Views:
    918
    John C. Bollinger
    Jan 17, 2005
  5. Replies:
    3
    Views:
    4,945
    Peter Bromberg [C# MVP]
    Mar 6, 2008
Loading...

Share This Page