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

  • SEARCH
  • Home
  • 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 8749341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:40:44+00:00 2026-06-13T12:40:44+00:00

Im currently pulling a string comment from a DB into a gridview to display

  • 0

Im currently pulling a string comment from a DB into a gridview to display to the user. Throughout the string i have placed <br/>s where i want linebreaks, but am wondering how to replace the <br/>s with “Environment.Newline”s. the column is simply a boundfield.

  <Columns>  
            <asp:BoundField HeaderText="Comment" DataField="UAComment" />
  </Columns>

and im populating the table with an adapter and Fill():

            adapter = new SqlDataAdapter(queryString, connection);
            connection.Open();
            adapter.SelectCommand = command;
            recordsFound = adapter.Fill(table);
            results.Text = recordsFound + " records matching query";
            connection.Close();

Thanks for any info.

ps: also tried already building the string/submitting the string to the database with newlines but cant seem to get it to pull out of the db with the proper formatting.

public void Group(String message)
    {
        log.Append(": Group :");
        log.AppendFormat(message);
        log.Append("<br/>");
    }


    public String GetLog()
    {
        log.Replace("<br/>", Environment.NewLine);
        return log.ToString();
    }

also substituted “Environment.Newline” with @”\n”, “\n”, @”\r”, “\r”

  • 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-13T12:40:45+00:00Added an answer on June 13, 2026 at 12:40 pm

    The easiest solution would be use a template field instead of bound field and add bind a literal in the template field with current column value. Using this it will render all the stuff in html format and the line breaks come autometically.

    Example :

    <asp:TemplateField>
        <HeaderTemplate>
            Comment
        </HeaderTemplate>
        <ItemTemplate>
            <asp:Literal runat="server" ID="Literal1" Text='<%# Eval("UAComment") %>' />
        </ItemTemplate>
    </asp:TemplateField>
    

    Hope this will fix you problem

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

Sidebar

Related Questions

currently I'm pulling text from a website using public String getText(String uri) { HttpClient
I am currently pulling an XML feed into a webapp through ajax. Obviously i
I'm currently pulling emails from an exchange inbox like so... var exchangeService = new
Im pulling a text file - it will be input by user currently its
Currently I am using HTML files for parts of my user interface. I display
We are currently porting some php scripts that are pulling datetimes from the facebook
I am pulling a flat hash of parameters from an external API into my
I am pulling data from my database and trying to encode into JSON data
I'm currently pulling info from an sql DB where the 'cachedDist' column is set
I am currently pulling start times from an XML file and using a date

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.