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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:34:11+00:00 2026-05-20T18:34:11+00:00

I have datagridview with checkbox column, and the checkbox within the column can be

  • 0

I have datagridview with checkbox column, and the checkbox within the column can be checked or unchecked with external checkbox. It works fine while selecting all the columns and saving the data in database. But, when I unchecked the checkbox in the datagridview with external checkbox and again select the single checkbox within the datagridview, it again takes the rowindex of all the checkbox within the column.

if (chkbranches.Checked == true)
{
  foreach (DataGridViewRow dr in gridviewholiday.Rows)
  {
    dr.Cells[0].Value = true;
  }

  for (int i = 0; i < gridviewholiday.Rows.Count; i++)
  {
    rowindex = i;
    list.add(rowindex);//to put the rowindex in array list
  }
}
else if (chkbranches.Checked == false)
{
  foreach (DataGridViewRow dr in gridviewholiday.Rows)
  {
    dr.Cells[0].Value = false;
    gridviewholiday.Refresh();
    gridviewholiday.ClearSelection();
    list.Clear();
  }
}
  • 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-20T18:34:12+00:00Added an answer on May 20, 2026 at 6:34 pm

    Why do you loop twice if chkbranches is checked? Can’t you add items to the list within the first foreach? And in the loop for unchecking, why do you refresh, and clear both controls each time? Probably only needed once.

    And as mentioned, this isn’t doing anything about single checks. If you’re expecting it to, that seems to be the problem.

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

Sidebar

Related Questions

I have datagridview with checkbox column, but I want, that some of the columns
I have a DataGridView with a checkbox column. I'm trying to create a select/deselect
I have a datagridview with a column with checkbox in it. What I am
I have DataGridView with two columns. The first column is TextBoxCol(DataGridViewTextBoxColumn) and the Second
hi i have a datagridview whose first column (index = 0) is a checkbox
Ok, the first column in my datagridview is a checkbox. I have 'multiselect' set
I have a datagridview that I've added a checkbox column to. When I preview
I have a Winforms DataGridView in my application. I've two checkbox columns along with
I have a DataGridview with several columns, and one of the column is DataGridViewComboBoxColumn.
I have datagridview with checkboxcolumn. How can I detect when checkbox state in cell

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.