Prem Sahani

Prem Sahani

  • NA
  • 123
  • 10.1k

how to update pannel of gridview data delete in asp.net C#

Jun 7 2017 12:16 PM
protected void grdModalMembers_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
con.Open();
int index = Convert.ToInt32(e.RowIndex);
index = 0;
GridViewRow selectedRow = grdModalMembers.Rows[index];
string MembershipCd = selectedRow.Cells[2].Text; //assuming your ID is the first column of your grid
SqlCommand sq = new SqlCommand("Delete from MembershipMast where FirstName='" + MembershipCd + "'", con);
sq.ExecuteNonQuery();
Response.Write("Deleted");

}
 
please solve my problem  thanks