GridView_RowsDeleting event doesn't work

Posted by iTayb on Stack Overflow See other posts from Stack Overflow or by iTayb
Published on 2010-04-09T22:47:48Z Indexed on 2010/04/09 22:53 UTC
Read the original article Hit count: 533

Filed under:
|
|

I have a datagarid with a onrowdeleting="SellersGridView_RowsDeleting" switch. My method is:

protected void SellersGridView_RowsDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string seller = ((Label)SellersGridView.Rows[e.RowIndex].Cells[0].FindControl("TextBoxSeller")).Text;
        BookStore b = new BookStore();
        b.LoadFromXML(Server.MapPath("list.xml"));
        string ISBN = Request.QueryString["ISBN"].ToString();
        int ID = b.BooksList.FindIndex(x => x.ISBN == ISBN);
        Book myBook = b.BooksList[ID];
        myBook.RemoveSeller(seller);

        Response.Redirect("editbook.aspx?ISBN=" + ISBN);
    }

Well, it seems that when I try to delete anything - nothing happens. I tried to change the first line to Response.Redirect("foo") just to check if the event itself is fired, and it turns out that it doesn't. I can't get The reason.

Here is my gridview control: http://pastebin.com/CKDAMECT

Thank you very much!

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET