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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:50:45+00:00 2026-06-01T15:50:45+00:00

I implemented the table sorter yesterday and i have a problem trying to change

  • 0

I implemented the table sorter yesterday and i have a problem trying to change the color of cells if a certain time is less then the current time i want to change the cells red if they fail this is my C# Code we originally just had a gridView which worked fine but we wanted to change it to make it faster for sorting heres the c# Code

 protected void gvResult_rowDataBound(Object sender, GridViewRowEventArgs e)
        {
            DateTime AppointmentTime = DateTime.Now;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                AppointmentTime = Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem, "AppointmentTime"));

                if (AppointmentTime < DateTime.Now)
                {

                    e.Row.CssClass = "gvRowRed";
                    e.Row.Cells[0].CssClass = "white";
                    e.Row.Cells[1].CssClass = "white";
                    e.Row.Cells[2].CssClass = "white";
                    e.Row.Cells[3].CssClass = "white";
                    e.Row.Cells[4].CssClass = "white";
                    e.Row.Cells[5].CssClass = "white";
                    e.Row.Cells[6].CssClass = "white";
                    e.Row.Cells[7].CssClass = "white";
                }
                else if (AppointmentTime > DateTime.Now && AppointmentTime < DateTime.Now.AddHours(1))
                {
                    e.Row.CssClass = "gvRowGreen";
                    e.Row.Cells[0].CssClass = "white";
                    e.Row.Cells[1].CssClass = "white";
                    e.Row.Cells[2].CssClass = "white";
                    e.Row.Cells[3].CssClass = "white";
                    e.Row.Cells[4].CssClass = "white";
                    e.Row.Cells[5].CssClass = "white";
                    e.Row.Cells[6].CssClass = "white";
                    e.Row.Cells[7].CssClass = "white";
                }
            }


       }

Its the first part im concentrating on at the moment so if appointmenttime is less then datetime.now i need to color the cells background red and the color of the font white but for some reason thebackground color doesnt change, only the color of the font does any help would be appreciated.

Heres the CSS

table.tablesorter {
    font-family:arial;
    background-color: #CDCDCD;
    margin:10px 0pt 15px;
    width: 100%;
    text-align: left;
}
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
    background-color: #336699;
    border: 1px solid black;
    padding: 10px 15px;
    vertical-align:middle;
    font:verdana;
    color:White;
}
table.tablesorter thead tr .header {
    background-image: url('/img/bg/bg.gif');
    background-repeat: no-repeat;
    background-position: center right;
    cursor: pointer;
}
table.tablesorter tbody td {
    color: #3D3D3D;
    padding: 4px;
    background-color: #FFF;
    vertical-align: top;
}
table.tablesorter tbody tr.odd td {
    background-color:#F0F0F6;
}
table.tablesorter thead tr .headerSortUp {
    background-image: url('/img/bg/asc.gif') ;
    background-repeat: no-repeat;
    background-position: center right;
}
table.tablesorter thead tr .headerSortDown {
    background-image: url('/img/bg/desc.gif');
    background-repeat: no-repeat;
    background-position: center right;
}
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
background-color: #8dbdd8;
}

.gvRowRed
{
    background-color:Red !important;
}

.white
{
color:#ffffff !important;
}

  • 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-01T15:50:46+00:00Added an answer on June 1, 2026 at 3:50 pm

    Try changing

    .gvRowRed
    {
        background-color:Red !important;
    }
    

    to

    .gvRowRed td
    {
        background-color:Red !important;
    }
    

    and the same for gvRowGreen – it’s applying the class to the row rather than the cell.

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

Sidebar

Related Questions

Lets say that I have only DHT (distributed hash table) implemented (in Python), and
I have implemented inheritance for two parent classes called Table and Field . Each
So, I have implemented this method to add a footer to my table view:
I have a symbol table implemented as a std::map . For the value, there
I have a table, a trigger on the table implemented using service broker. More
I have an HTML table with less than 50 rows. I am using Sorttable
I have implemented single table inheritance for a person class class Person < ActiveRecord::Base
I have implemented a UISearchBar into a table view and almost everything is working
Good evening all, I'm trying to implement jquery table sorter, all seems fine and
i am using the code i have already implemented the table drag and drop

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.