Saturday, May 28, 2011

Gridview_RowDeleting Event




 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        TableCell cell = GridView1.Rows[e.RowIndex].Cells[2];
        if (cell.Text == "Chai")
        {
            e.Cancel = true;
            //  lblmsg.Text = "You cannot delete : Chai";
           ClientScript.RegisterStartupScript(GetType(), 
                "Message""<SCRIPT LANGUAGE='javascript'>
                alert('You cannot delete this product.');</script>");
        }         
         else
        {
           Response.Write("Product Deleted");
        }
    }




0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More