Formatting text in PanelBar items with newlines

3 posts, 1 answers
  1. Frank Grimes
    Frank Grimes avatar
    4 posts
    Member since:
    Dec 2009

    Posted 15 Jan 2010 Link to this post

    Is there a way to make a PanelBar item display text formatted with newline/carriage returns? I am currently building my text string to be displayed with the proper formatting:

    string itemText = "Some text on line 1" + Environment.NewLine + "Some text on line 2";
    RadPanelItem item = new RadPanelItem();
    item.text = itemText;

    I am expecting the item to be displayed as:

    Some text on line 1
    Some text on line 2

    However, everything is shown on one line until the width of the item has been reached and the text then just wraps around:

    Some text on line 1Some tex
    t on line 2

    This is a minor content formatting issue in my application, but is it possible?
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Jan 2010 Link to this post

    Hi Steven Rosaria,

    I used <br /> in my application for formatting the text with new line. Give a try with following code.

    CS:
     
      string itemText = "Some text on line 1 <br />Some text on line 2"
      RadPanelItem item1 = new RadPanelItem(); 
      item1.Text = itemText; 
      RadPanelBar2.Items.Add(item1); 

    Regards,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Frank Grimes
    Frank Grimes avatar
    4 posts
    Member since:
    Dec 2009

    Posted 18 Jan 2010 Link to this post

    Of course, I forgot that this was being rendered as HTML. In any case, your suggestion worked. Thanks!
Back to Top