foreach (RepeaterItem ri in RepDetails.Items)
{
CheckBox item_check = (CheckBox)ri.FindControl("chkmessages");
Label txt_id = (Label)ri.FindControl("lblMessageID");
if (item_check.Checked)
{
using (SqlConnection con = new SqlConnection("Data Source=BCILGGN45\\SQLEXP2012;Initial Catalog=SampleDataBase;User ID=sa;Password=sql@2012"))
{
using (SqlCommand cmd = new SqlCommand("[USP_MESSAGEMASTER]", con))
{
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
cmd.Parameters.Add("@Type", SqlDbType.VarChar, 50).Value = "DELETE";
cmd.Parameters.Add("@MessageID", SqlDbType.Int).Value = Convert.ToInt16(txt_id.Text);
cmd.ExecuteNonQuery();
}
}
}
}
January 10, 2017
Deleteing seleted items from Repeator Control
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment