Click here to Skip to main content
14,361,750 members
Rate this:
Please Sign up or sign in to vote.
See more:
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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.
   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100