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

The Archive Base Latest Questions

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

i have a datagrid and every row has a checkbox on it. also every

  • 0

i have a datagrid and every row has a checkbox on it. also every field in every row can be updated

the user can update multiple rows and check any checkboxes.

at the click of the SUBMIT button all the data should be updated. i need the checkboxes to update a boolean (or what ever the bool type is for sql server) in a database.

  1. how do implement the checkboxes to be able to update the table in the DB?
  2. with the click of the submit button how do i get all the data to be updated?
  • 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-26T04:20:30+00:00Added an answer on May 26, 2026 at 4:20 am

    Go through the datagrid and store all of the data that you want to update in arrays or the like. Sql server has a bit datatype and you can set it to 0 if the checkbox is off or 1 if it is checked. Once you collect all the data pass it to your data layer for a sql update

    You can use the DataGrid object to iterate through its cells/controls. For example, using a nested loop you can do:

    myDG.Items[index1].Cells[index2].Controls[0]
    

    Edit: It depends on the input controls you have in the columns because you have to cast them. Say you have a datagrid with 10 columns and TextBoxes in all columns except the last, which is CheckBox, you would do:

    CheckBox cb = null;
    TextBox tb = null;
    List<string> myList = new List<string>();
    for(int row = 0; row < myDG.Items.Count; row++)
    {
      for(int col = 0; col < myDG.Columns.Count; col++)
      {
        if(col < 9){
          tb = myDG.Items[row].Cells[col].Controls[0] as TextBox;
          myList.Add(tb.Text);
        }
        else{
          cb = myDG.Items[row].Cells[col].Controls[0] as CheckBox;
          myList.Add(((cb.Checked) ? "1" : "0"));
        }
      }
    }
    

    You could use a 2D array/list to store if you wanted too. HTH

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

Sidebar

Related Questions

I have a HyperLinkButton in every row of a datagrid in my silverlight app.
I have a DataGrid component that I would like to update every 5 seconds.
I have a datagrid, populated as shown below. When the user clicks on a
I have a DataGrid where each column has a SortExpression. I would like the
I have a DataGrid, with an ItemTemplate that has an image and label. In
I have a datagrid which is populated with CSV data when the user drag/drops
I have a dataGrid(not dataGridView) in which i need to add Checkbox dynamically at
I have an ObservableCollection bound to a WPFToolkit DataGrid in an MVVM pattern. Every
I have a C# WPF app that every time the user opens a new
I have a Silverlight Datagrid who's DataSource I refresh every 5 seconds. I would

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.