Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9081103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:14:03+00:00 2026-06-16T20:14:03+00:00

I have a generic html control – a ‘P’ tag, which i’ve added a

  • 0

I have a generic html control – a ‘P’ tag, which i’ve added a runat="server" to.

I construct a string using Stringbuilder methods and apply this to the InnerHtml attribute of the tag.

The text,which contains a number of sb.Appendline()‘s still displays as a paragraph would, wrapping but without creating any new lines. However, When i look at the markup created, the new lines are there, shown as spacing.

This is also the case with a DIV

Anyone got any ideas as to how i fix this?

Code below:

        var sb = new StringBuilder();
        sb.Append("Congratulations!");
        sb.AppendLine();
        sb.AppendLine();
        sb.AppendFormat("Your application was accepted by <b>{0}</b>.", response.AcceptedLender);
        sb.AppendLine();
        sb.AppendFormat("Your reference number is <b>{0}</b>.", response.PPDReference);
        sb.AppendLine();
        sb.AppendLine();
        sb.Append("Click the button below to sign your loan agreement electronically and collect your cash.");

        AcceptedMessage.InnerHtml = sb.ToString();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:14:04+00:00Added an answer on June 16, 2026 at 8:14 pm

    Instead of using AppendLine should use AppendFormat:

    myStringBuilder.AppendFormat("{0}<br />", strToAppend);
    

    If you need these line breaks to remain “as is” because you’re displaying it in a text file or something of that nature, you’ll need to replace the new line text with html breaks when you’re calling the .ToString() method.

    myStringBuilder.Replace(Environment.NewLine, "<br />").ToString();
    

    Using Environment.NewLine here may not work, you may actually need to replace \r\n.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a generic method which adds all the html controls I have on
If I have the below PartialView <%@ Control Language=C# Inherits=System.Web.Mvc.ViewUserControl<Models.Photo> %> <% using (Html.BeginForm(MyAction,
I have created a custom server control. It looks great and the rendered HTML
I have generic list which must be a preserved order so I can retrieve
I have a Generic List object which hold below table as its own value.
I have created a custom server control with properties implementing the ITemplate interface. It
HTML: <body> <form id=form1 runat=server> <div> <asp:LoginView ID=LoginView1 runat=server> <AnonymousTemplate> <asp:Login ID=Login1 runat=server OnLoginError=LoginError>
I have a page with a ScriptManager, a generic HTML drop-down list ( <select>
I have a Generic ListView, each item in my html list links to a
I have a generic 'form page' user control that we use that allows editors

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.