gridview
code behind file
protected void SentBoxGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
GridViewRow row = SentBoxGridView.Rows[e.RowIndex];
TextBox MessageId = (TextBox)row.FindControl("MessageId");
SqlConnection con;
con = new SqlConnection(ConfigurationManager.ConnectionStrings["SAVARIConnectionString5"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("delete from Messages where MessageId='" + MessageId + "'", con);
cmd.ExecuteNonQuery();
con.Close();
}
{
GridViewRow row = SentBoxGridView.Rows[e.RowIndex];
TextBox MessageId = (TextBox)row.FindControl("MessageId");
SqlConnection con;
con = new SqlConnection(ConfigurationManager.ConnectionStrings["SAVARIConnectionString5"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("delete from Messages where MessageId='" + MessageId + "'", con);
cmd.ExecuteNonQuery();
con.Close();
}
Manas MohapatraPosted Apr 19, 2016, 4:42 AM