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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:13:04+00:00 2026-06-10T05:13:04+00:00

DataGridView has an AlternatingRowsDefaultCellStyle, which works like a champ. But I need the opposite

  • 0

DataGridView has an “AlternatingRowsDefaultCellStyle,” which works like a champ. But I need the opposite sort of demarcation/decoration. Is there a property that can get the column backgrounds to be a different color than the default, or do I need to write code for the CellFormatting event, or…?

UPDATE

OK, this seems odd:

With this code, from Ascension:

dataGridView1.Columns[i].ItemStyle.BackColor = Color.Blue;

…I get:

‘System.Windows.Forms.DataGridViewColumn’ does not contain a definition for ‘ItemStyle’ and no extension method ‘ItemStyle’ accepting a first argument of type ‘System.Windows.Forms.DataGridViewColumn’ could be found (are you missing a using directive or an assembly reference?)

However, if I enter just the first part (dataGridView1.Columns[i].), I DO get “ItemStyle” via Intellisense as a valid option to select, but then it turns red when I do (possibly a Resharper effect). A dot after that allows the BackColor property to be selected, which is then NOT red.

Why is this bizarre behavior occurring, and is there a workaround?

And: Do red Intellisense items indicate inaccessibility, and if so, why are they displayed? Are “teaser” members of any value?

UPDATE 2

This works (inspired by Ascension, so I’m giving him/her the correct answer):

DataGridViewCell cell = new DataGridViewTextBoxCell();
cell.Style.BackColor = Color.Wheat;
dataGridView1.Columns[i].CellTemplate = cell;
  • 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-10T05:13:05+00:00Added an answer on June 10, 2026 at 5:13 am

    Try this:

    DataGridView Property -> Misc -> Columns ... -> ItemStyle -> BackColor
    

    or the script below

    protected void Page_Load(object sender, EventArgs e)
            {
                for (int i = 0; i < GridView1.Columns.Count; i++)
                {
                    if (i % 2 == 0)
                    {
                        GridView1.Columns[i].ItemStyle.BackColor = Color.Red;
                    }
                    else
                    {
                        GridView1.Columns[i].ItemStyle.BackColor = Color.Blue; ;
                    }
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which has a RichTextBox docked to the left and DataGridView
I have a DataGridView which has different rows and columns and it work perfectly
I have a DataGridView in which one column has data that the user needs
We discovered a possible bug involving the DataGridView. The DataGridView has a property, StandardTab,
I have a dataGridView that has a column called Date Due which is of
I have a form created which an unbound datagridview that has three columns. Position,
I have a Winform DataGridView , which has a number of predefined columns. Now
I have a form that has a DataGridView as it's main component. I need
I'm working on a C# application (windows form) which has a DataGridView which is
I'd like to add a button column dynamically to a DataGridView after it has

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.