Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
XML
In my project i wanna delete one rows in a grid view , i tried this coding but one error ll occur, plz help.
the error is

An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll



 <pre lang="cs">protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        //GridView1.DeleteRow(e.RowIndex);
        Response.Write(e.RowIndex.ToString());
        GridView1.DeleteRow(e.RowIndex);
    }</pre>
Posted

1 solution

In the GridView1_RowDeleting event, you are calling GridView1.DeleteRow(e.RowIndex);.
This is putting the code into an infinite loop hence causing this error.
Basically, you call 'delete row' in a method that has already called 'delete row'

Comment out GridView1.DeleteRow(e.RowIndex); and you should not get this error.
 
Share this answer
 
Comments
shiva30 12-Mar-12 2:12am    
i have a button on a grid view for delete, i want wen i click the button ,the current row is deleted .so plz help wat ll i do...

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