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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:53:55+00:00 2026-06-04T02:53:55+00:00

So basically I have data being pulled from a database for which I want

  • 0

So basically I have data being pulled from a database for which I want it to display in a gridview. Unfortunately, the days of the week are stored as integers so that monday is equal to 0 and tuesday is 1 etc etc.

Basically, how do I go about changing that data as it is being outputted so that it converts the number to the correct day of the week.

I have got a grid view as follows and at the moment I have it set up with onrowdatabound :

 <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
                        AutoGenerateColumns="False" DataSourceID="SqlDataSource2" Width="721px"  
                        onrowdatabound="GridView_RowDataBound" 
                        >

Then the code behind for GridView_RowDataBound is :

  protected void GridView_RowDataBound(Object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
        {

        }

    }

I assume that I just need to put the right code in there. However, for some reason I can’t do anything to a single cell only to every single cell in a particular column. So I could change every cell in one column to bold but can’t individually change a cell. I’m sure there is a way but can’t fathom how to do it!

Any help would be much appreciated!

Thanks

        protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int days = (int)GridView1.Rows[e.Row.RowIndex].Cell[2].Text;
            if (days == 0) GridView1.Rows[e.Row.RowIndex].Cell[2].Text = "Monday";
            if (days == 1) GridView1.Rows[e.Row.RowIndex].Cell[2].Text = "Tuesday";
            if (days == 1) GridView1.Rows[e.Row.RowIndex].Cell[2].Text = "Wednesday";
            if (days == 1) GridView1.Rows[e.Row.RowIndex].Cell[2].Text = "Thursday";
            if (days == 1) GridView1.Rows[e.Row.RowIndex].Cell[2].Text = "Friday";

        }

    }
  • 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-04T02:53:56+00:00Added an answer on June 4, 2026 at 2:53 am

    You can try this.

    if (e.Row.RowType == DataControlRowType.DataRow)
    {
         string days = e.Row.Cells[2].Text;
         if (days == "0") e.Row.Cells[2].Text = "Monday";
         if (days == "1") e.Row.Cells[2].Text = "Tuesday";
         if (days == "2") e.Row.Cells[2].Text = "Wednesday";
         if (days == "3") e.Row.Cells[2].Text = "Thursday";
         if (days == "4") e.Row.Cells[2].Text = "Friday";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have a table that is being used to display data from an
I have an application that shows data from a MySQL table. Basically, my application
Basically I have a set of checkboxes that are dynamically created from view data
I am using a dataset to insert data being converted from an older database.
Possible Duplicate: Xcode: Storyboard Tabbed Application Passing Data Back and Forth Basically I have
I have a nice DataGridView showing what is basically some kind of log data
Basically I have a getjson call to call for a bunch load of data.
Basically I have a WPF application that will display announcements to the user within
Basically I have a bunch of submission forms that gather data in a generic
I have an application that imports data read from text files from a directory

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.