Click here to Skip to main content
15,891,753 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i use the following code for deleting seleted row in gridview.But the Removeat function make a error.can u solve this..advance thanks..

C#
for(int i=0;i<GridView2.Rows.Count;i++)
    {
      CheckBox chkSel=(CheckBox)GridView2.Rows[i].FindControl("chkselect");
      if(chkSel.Checked==true)
          GridView2.Rows.RemoveAt(i);
    }



The error is



'System.Web.UI.WebControls.GridViewRowCollection' does not contain a definition for 'RemoveAt' and no extension method 'RemoveAt' accepting a first argument of type 'System.Web.UI.WebControls.GridViewRowCollection' could be found (are you missing a using directive or an assembly reference?)
Posted
Comments
Pankaj P Sharma 22-Oct-12 3:26am    
In which event are you trying to delete the row? Try some other event like RowCommand.

1 solution

Try the following link....
http://forums.asp.net/t/1105499.aspx/1[^]

I think it addresses your issue..
 
Share this answer
 

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