Need a new line in my label tag

Discussion in 'ASP .Net' started by moni, Apr 23, 2007.

  1. moni

    moni Guest

    Hi,

    I am getting a label to display data on page load after retreiving
    from the SQL server. But I need to display many values, so I am
    concatenating a string value and then using a label to display it.

    totalMessage = (string)dreader1.GetValue(2);
    totM += totalMessage + "\n";
    Label8.Visible = true;
    Label8.Text =totM;

    But I am not getting the values on seperate lines. What may I have to
    do for that?

    Any help will be appreciated. Thanks alot!
     
    moni, Apr 23, 2007
    #1
    1. Advertisements

  2. moni

    Mark Rae Guest

    "moni" <> wrote in message
    news:...

    > I am getting a label to display data on page load after retreiving
    > from the SQL server. But I need to display many values, so I am
    > concatenating a string value and then using a label to display it.
    >
    > totalMessage = (string)dreader1.GetValue(2);
    > totM += totalMessage + "\n";
    > Label8.Visible = true;
    > Label8.Text =totM;
    >
    > But I am not getting the values on seperate lines. What may I have to
    > do for that?
    >
    > Any help will be appreciated. Thanks alot!


    Change "\n" to "<br />"
     
    Mark Rae, Apr 23, 2007
    #2
    1. Advertisements

  3. You're using a \n, which is the escape character for a string. That's fine
    for the string, but that means absolutely nothing to the browser. The the
    web browser that's just whitespace. You'll need to concatenate an HTML
    linebreak instead of a string linebreak. Try "<br />" instead.


    --
    Hope this helps,
    Mark Fitzpatrick
    Former Microsoft FrontPage MVP 199?-2006

    "moni" <> wrote in message
    news:...
    > Hi,
    >
    > I am getting a label to display data on page load after retreiving
    > from the SQL server. But I need to display many values, so I am
    > concatenating a string value and then using a label to display it.
    >
    > totalMessage = (string)dreader1.GetValue(2);
    > totM += totalMessage + "\n";
    > Label8.Visible = true;
    > Label8.Text =totM;
    >
    > But I am not getting the values on seperate lines. What may I have to
    > do for that?
    >
    > Any help will be appreciated. Thanks alot!
    >
     
    Mark Fitzpatrick, Apr 23, 2007
    #3
    1. Advertisements

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,608
    Matt Humphrey
    Oct 18, 2004
  2. shruds
    Replies:
    1
    Views:
    1,251
    John C. Bollinger
    Jan 27, 2006
  3. Replies:
    1
    Views:
    773
    Tim Roberts
    May 1, 2006
  4. kaushikshome
    Replies:
    4
    Views:
    1,030
    kaushikshome
    Sep 10, 2006
  5. scad
    Replies:
    23
    Views:
    1,466
    Alf P. Steinbach
    May 17, 2009
  6. Marek Stepanek
    Replies:
    12
    Views:
    690
    Peter J. Holzer
    Sep 2, 2006
  7. Replies:
    2
    Views:
    779
    Thomas 'PointedEars' Lahn
    Mar 11, 2008
  8. Knut Krueger
    Replies:
    8
    Views:
    630
    Knut Krueger
    Aug 20, 2013
Loading...