Sunday, 11 December 2011

Grid View row delet with Alert Message

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
    Label lb = (Label)GridView1.Rows[e.RowIndex].FindControl("Label6");
    sqlcon = new SqlConnection(con);
    sqlcon.Open();
    string sql = "delete from empdetails where empno='" + lb.Text + "'";
    SqlCommand cmd = new SqlCommand(sql);
    cmd.CommandType = CommandType.Text;
    cmd.Connection = sqlcon;
    cmd.ExecuteNonQuery();
    GridView1.EditIndex = -1;
    showgrid();
}
       

No comments:

Post a Comment