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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:11:59+00:00 2026-05-30T04:11:59+00:00

I am facing a strange problem when using the gridview control in ASP.NET. I

  • 0

I am facing a strange problem when using the gridview control in ASP.NET. I am using paging in it.

The second column in the grid is an “Order status” column which contains values such as “D”, “S”, etc. The “D” and “S” are database values representing “Delivered” and “Shipped”. We are using these representations to save space in the database.

Now, while displaying it in the GridView, I would like it to be displayed as “Displayed” or “Shipped” instead of the “D” and “S” which comes as part of the data source. When loading the page for the first time, I am handling it by getting the rows of the current page and changing the “D” and “S” of cells with “Delivered” and “Shipped” with the help of the Page Load Event.

But, the problem occurs when I go to the next page using the paging controls of the grid view.

The values in the “Order Status” column doesn’t get updated to the “D” and “S” in the second page and hence my function will fail to pick them up and fail to convert them to “Delivered” and “Shipped”.

I tried the OnPageIndexChanged event as well. Not working even with that 🙁

Here’s the code.

GRIDVIEW CONTROL

<asp:GridView ID="OrderGrid" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" DataSourceID="OrderHistory" AlternatingRowStyle-CssClass="alt"
                CssClass="order_grid" DataKeyNames="order_id" OnPageIndexChanging="OrderGrid_PageIndexChanging">

SET ORDER STATUS METHOD

public void SetOrderStatus()
{
    string Delivered = "Delivered";
    string Shipped = "Shipped";
    string Processing = "Processing";

    for (int i = 0; i < OrderGrid.Rows.Count; i++)
    {
        if (OrderGrid.Rows[i].Cells[1].Text == "D")
        {
            OrderGrid.Rows[i].Cells[1].Text = Delivered;
            OrderGrid.Rows[i].Cells[1].BackColor = System.Drawing.Color.FromName("#127b41");
            OrderGrid.Rows[i].Cells[1].ForeColor = System.Drawing.Color.FromName("#fdfdfd");
        }

        if (OrderGrid.Rows[i].Cells[1].Text == "S")
        {
            OrderGrid.Rows[i].Cells[1].Text = Shipped;
        }

        if (OrderGrid.Rows[i].Cells[1].Text == "P")
        {
            OrderGrid.Rows[i].Cells[1].Text = Processing;
        }
    }
}

PAGE INDEX CHANGING FUNCTION

protected void OrderGrid_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    OrderGrid.PageIndex = e.NewPageIndex;
    OrderGrid.DataBind();

    SetOrderStatus();
    string o = OrderGrid.Rows[0].Cells[1].Text;
}

I would not normally post all my code, but I am desperate to get a solution to this problem. I would greatly appreciate any help that comes.

Thanks in advance!

  • 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-30T04:12:00+00:00Added an answer on May 30, 2026 at 4:12 am

    Try updating this in the RowDataBound event. This allows you to make an adjustment at the binding of each row.

    Here’s an example:
    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx

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

Sidebar

Related Questions

I'm facing a very strange problem in my ASP.NET Application. When the user clicks
I am facing strange problem. I am compiling a MFC application(VS 2008) which uses
We are facing a strange problem. We have a user control written in WPF
I'm facing a kind of strange problem and don't know in which direction to
I am facing quite strange problem. Application ~80.Mb Testing on simulator using Allocations Instrument,
I am facing a strange problem regarding Hooking. I have a procedure which acts
I am facing the very strange problem in HTML/CSS.I am using chrome 12.0.742.122. Now
I am using Symfony 2.0 beta3 and I am facing a rather strange problem.
Good morning, I´m facing a very strange problem on which I haven´t found a
i am facing strange problem i deployed a webservice in EC2 which is up

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.