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. Advertising

  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. Advertising

  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. 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. Shapper
    Replies:
    2
    Views:
    713
    Scott Mitchell [MVP]
    May 7, 2005
  2. Josef K.

    <label><div></div></label> allowed?

    Josef K., May 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    13,263
    Josef K.
    May 22, 2005
  3. shruds
    Replies:
    1
    Views:
    710
    John C. Bollinger
    Jan 27, 2006
  4. Replies:
    1
    Views:
    712
    Tim Roberts
    May 1, 2006
  5. Knut Krueger
    Replies:
    8
    Views:
    238
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page