Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have to delete row from GridView. First I have to check the CheckBox and then click Delete button in GridView. This will not affect database. The row will be deleted from GridView.

How can I do this? Please help me.
Posted
v2

 
Share this answer
 
can you show your code?

or you can refer to this snippets

C#
if (checkedbox1.Checked)
{
 GridView1.Rows.Remove(TheSelectedRow);
 GridView1.DataSource=//Call the Databinding
}
 
Share this answer
 
Apply a for loop on the grid. Find the check box control from the grid like this:-
C#
for(int i=0;i<grdView.rows.count,i++)>
     {
       CheckBox chkSel=(CheckBox)grdView.Rows[i].FindControl("chkselect");
       if(chkSel.checked==true)
         grdView.Rows.RemoveAt(i);
     }


Give it a try.
 
Share this answer
 
Comments
Sumon562 17-Feb-14 2:26am    
Remove at does not get
Sumon562 17-Feb-14 23:45pm    
This does not work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900