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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:30:20+00:00 2026-05-22T00:30:20+00:00

I am changing the background color for individual cells in the DayRender control, but

  • 0

I am changing the background color for individual cells in the DayRender control, but when I select a different date the background color i chose for the cells are lost. I’ve looked around and can’t really find what I am looking for. Hopefully the code will make it a bit more clear on what I want my code to do.

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{String sFullDate, sTradacomsDate;
    XmlNode node;

    sFullDate = e.Day.Date.Day.ToString("00") + "/" + e.Day.Date.Month.ToString("00") + "/" + e.Day.Date.Year.ToString();
    sTradacomsDate = e.Day.Date.Year.ToString().Substring(2,2) + e.Day.Date.Month.ToString("00") + e.Day.Date.Day.ToString("00");

    if (xmlDoc != null)
    {
        node = xmlDoc.SelectSingleNode("Dates/dbo.ASNs[FileDate = '" + sFullDate + "']");

        if (node != null)
        {
            e.Cell.BackColor = System.Drawing.Color.YellowGreen;
            e.Cell.ForeColor = System.Drawing.Color.White;
        }
    } 
    if (xmlDoc2 != null)
    {
        node = xmlDoc.SelectSingleNode("Dates/dbo.Orders[DateOrderPlaced = '" + sTradacomsDate + "']");

        if (node != null)
        {
            if (e.Cell.BackColor == System.Drawing.Color.Green)
            {
                e.Cell.BackColor = System.Drawing.Color.Orange;
                e.Cell.ForeColor = System.Drawing.Color.White;
            }
            else 
            {
                e.Cell.BackColor = System.Drawing.Color.Blue;
            }
        }
    }
  • 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-22T00:30:21+00:00Added an answer on May 22, 2026 at 12:30 am

    My guess is that you don’t have ViewState enabled for the control. When you select a date it performs a post back to handle the event; if ViewState is off and you don’t reset the cell colors, they will revert to the default state. Make sure EnableViewState="true" is enabled at the page, user control, and Calendar control levels.

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

Sidebar

Related Questions

I am changing the background color of the cells when the user has made
My code for changing the background color works great, but the else return does
tableview .BackgroundColor:[UIColor colorWithRed:1 green:1 blue:0.75 alpha:1]; This is my code for changing background color
I've noticed that changing the background color of an android widget ( ex. Button
How to make UIlabel roundRect shape ? By changing background color of UILabel it
I have taken this code from Changing the background color of a UIAlertView? UIAlertView
I don't want to highlight text (by changing background color to yellow - NO),
I just need to highlight a div by changing its background color for just
How can I inject custom CSS into a WebView like changing the background-color: of
I'm changing Background color of a button programmatically as below Button button =(Button)findViewById(R.id.one); button.setBackgroundColor(0xFFFF0000);

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.