Maintain formatting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dbuchanan

    Maintain formatting

    I want to fill a textbox or a label or with lines from a listbox. I want to
    preserve the lline for line as it comes from the list box. I do not want the
    test to run-on. I suppose it is okay to wrap if it is longer than the width
    of the control.

    This data will later be taken from this control and put into a text box in a
    report in ReportViewer where I will want to preserve the same formating
    there.

    Thank you,
    Doug


  • Steven Cheng [MSFT]

    #2
    RE: Maintain formatting

    Hi Doug,

    From your description, you want to display items from a ListBox in a
    TextBox/Label and still make each item's Text display in separate line,
    correct?

    I think for this question, the method will be different depend on the
    container element which will display the items. For example, if you want to
    display the items in label control, you need to append an html line break
    <br/element at the end of each item. However, if you use Textbox, since
    it display plain text, you need to append a plain text line break '\n' at
    the end. e.g.

    =============== =====
    protected void Page_Load(objec t sender, EventArgs e)
    {
    Label1.Text = "";
    foreach (ListItem item in ListBox1.Items)
    {
    Label1.Text += item.Text + "<br/>";
    }
    }
    =============== =====

    Also, if you want to move the text later to the reporting service report or
    any other display UI, you also need to take care of such difference on line
    break.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    msdnmg@microsof t.com.

    =============== =============== =============== =====
    Get notification to my posts through email? Please refer to
    Gain technical skills through documentation and training, earn certifications and connect with the community

    ications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscripti...t/default.aspx.
    =============== =============== =============== =====
    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------
    >From: "dbuchanan" <dbuchanan@news group.nospam>
    >Subject: Maintain formatting
    >Date: Thu, 26 Jun 2008 01:44:55 -0400
    >
    >I want to fill a textbox or a label or with lines from a listbox. I want
    to
    >preserve the lline for line as it comes from the list box. I do not want
    the
    >test to run-on. I suppose it is okay to wrap if it is longer than the
    width
    >of the control.
    >
    >This data will later be taken from this control and put into a text box in
    a
    >report in ReportViewer where I will want to preserve the same formating
    >there.
    >
    >Thank you,
    >Doug
    >
    >
    >

    Comment

    Working...