line break in a datagrid

Discussion in 'ASP .Net Datagrid Control' started by hannes, Mar 13, 2005.

  1. hannes

    hannes Guest

    hello to all,

    how to get an line break from a database to the datagrid?

    thanks,
    hannes
     
    hannes, Mar 13, 2005
    #1
    1. Advertising

  2. hannes

    Riki Guest

    hannes wrote:
    > hello to all,
    >
    > how to get an line break from a database to the datagrid?
    >
    > thanks,
    > hannes


    You didn't say in which language. I'm using VB.NET here.

    Turn AutoGenerateColumns off. Add BoundColumns instead.
    For the column that has line breaks, convert the BoundColumn
    to a TemplateColumn.
    In the TemplateColumn replace
    <%# DataBinder.Eval(Container.DataItem,"myField") %>
    with
    <%#
    DataBinder.Eval(Container.DataItem,"myField").ToString().Replace("vbCRLF","<br>")
    %>

    --

    Riki
     
    Riki, Mar 13, 2005
    #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. Hugo
    Replies:
    10
    Views:
    1,385
    Matt Humphrey
    Oct 18, 2004
  2. Niclas

    Displaying line break in Datagrid

    Niclas, Jun 3, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    2,636
    Niclas
    Jun 3, 2006
  3. kaushikshome
    Replies:
    4
    Views:
    821
    kaushikshome
    Sep 10, 2006
  4. Replies:
    12
    Views:
    1,007
  5. scad
    Replies:
    23
    Views:
    1,214
    Alf P. Steinbach
    May 17, 2009
Loading...

Share This Page