0

I am Developing Windows Form Application in .Net, I want to insert selected rows value of Gridview into database. First Column of my GridView is Checkbox, when user check one or more checkbox from gridview, i want to insert values of respective rows into Database.

4
Contributors
6
Replies
10
Views
7 Years
Discussion Span
Last Post by sourabhtripathi
0

I am Developing Windows Form Application in .Net, I want to insert selected rows value of Gridview into database. First Column of my GridView is Checkbox, when user check one or more checkbox from gridview, i want to insert values of respective rows into Database.

Try to use this

foreach (DataGridViewRow rw in dataGridView1.Rows)
{
//Ur checkbox verification and insertion of records.
}

1

that only i want to know,how to check which checkbox is checked.

Hi,

foreach (DataGridViewRow rw in dataGridView1.Rows)
            {
                if (rw.Cells[0].Value != null & Boolean.Parse(rw.Cells[0].Value.ToString())==true)
                {

                }
            } 

Just remove that 0 and replace with the column index of that checkbox. This works.

Edited by mike_2000_17: Fixed formatting

0

i an devloping a web application on e-recruitment..i have to insert the primary key(which is not shown in the gridview but is in the database) checked values of a grid view inside a separate table in the database..please help...i am working on asp.net.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.