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 216303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:33:07+00:00 2026-05-11T18:33:07+00:00

I am retrieving data from an Oracle database and binding the same to a

  • 0

I am retrieving data from an Oracle database and binding the same to a gridview control.

I noticed that there are instances when the column contains a single quote or double quote, the spaces or whitespace characters get stripped off.

Sample of some data in fields in Oracle:

To Be Phased Out ASAP ‘ “,

When retrieved, it becomes…

To Be Phased Out ASAP ‘ “,

And another one…

IT”S TEST RECORD” DDD ” FFF

which becomes

IT”S TEST RECORD” DDD ” FFF

I don’t have any clue why this is happening…

any ideas?

I think even here the spaces are getting trimmed. In my example in the first field which is:

To Be Phased Out ASAP ‘ “

there are actually two spaces after the single quote but it is displaying just a single space here.. Odd…

single quote space space double quote –> ‘ “

I think the extra space after a quote or single quote is being removed by asp.net??

I also found out that when I am editing my gridview, the extra white spaces are retained but when I go back to the original view, the whitespaces are gone.

To rephrase this question..

How Do I Preserve the WhiteSpace in the gridview when displaying the data?

  • 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-05-11T18:33:07+00:00Added an answer on May 11, 2026 at 6:33 pm

    This is not an ASP.Net thing, it is an HTML parsing thing. If you were to create a plain Jane HTML page with a div tag in it, and then put 100 spaces between the opening and closing tag it would all be condensed into a single space.

    This is a classic web issue. If you really want to have everything come out correctly, then you will need to HTML encode any spaces before displaying them on the page.

    Try replacing all your spaces with  

    Here is an article that explains this a little more in-depth: http://webdesign.about.com/od/beginningtutorials/f/blfaqwhitespace.htm

    To answer the question in the comment:

    If you need to have a lot of control over exactly what is going out to your grid even when it is DataBound, you can simply handle the RowDataBound event that fires after each row is bound.

    Suppose you have a GridView that looks like this:

    <asp:GridView ID="gbGridWithSpaces" AutoGenerateColumns="false" runat="server" 
        onrowdatabound="gbGridWithSpaces_RowDataBound">
        <Columns>
            <asp:BoundField DataField="ItemWithSpaces" HeaderText="Item With Spaces" />
        </Columns>
    </asp:GridView>
    

    In your code behind, you can handle the event to re-format the outgoing text however you please. For example:

    protected void gbGridWithSpaces_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        foreach (TableCell cell in e.Row.Cells)
        {
            cell.Text = cell.Text.Replace(" ", "&nbsp;");
        }
    }
    

    That would effectively replace all spaces with &nbsp; and preserve them even when rendered to the browser. Just remember your data will come back this way as well, so you will need to handle this on the server if you plan to pass this information back into persistent storage.

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

Sidebar

Ask A Question

Stats

  • Questions 208k
  • Answers 208k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer count($_GET); will return the number of parameters in the URL.… May 12, 2026 at 9:32 pm
  • Editorial Team
    Editorial Team added an answer The removal of the reflection bridge from FxCop was announced… May 12, 2026 at 9:32 pm
  • Editorial Team
    Editorial Team added an answer DEPRECATED ANSWER Django has since made this possible. Have you… May 12, 2026 at 9:32 pm

Related Questions

I have created an n-tier solution where I am retrieving related data from a
I am new to the concept of MVC and multi-tiered web architecture. I developing
I am developing an application which will be connected to Access database at the
I am designing an application and I'm looking for the best way to tell

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.