2
Answers

to delete a row in gridview

sanjay  gupta

sanjay gupta

15y
4.4k
1
sir

i want to delete a row with the help of checkbox using gridview. But i don't want to delete from database.
as we do in e-shopping after selecting the product we want to delete a specific record from selecting list.
But it should not be deleted from database.
 for (int i = 0; i < GridView.Rows.Count; i++)
        {
            CheckBox cbb = (CheckBox)GridView.Rows[i].FindControl("CheckBox1");
            if (cbb.Checked == true)
            {
               
             int id = Convert.ToInt32(GridView.Rows[i].Cells[1].Text);
            
            }

it gives the id of that row.
but how it is deleted from the gridview

please help me

Answers (2)