동적으로 생성 된 체크리스트 항목이 있습니다. 사용자가 삭제하면 확인 상자가 나타납니다. 내가 어떻게 할 수 있니?체크리스트 항목을 삭제할 때 확인 요청 방법은 무엇입니까?
protected void btndelete_Click(object sender, EventArgs e)
{
try
{
string conn = ConfigurationManager.ConnectionStrings["sqlconn"].ConnectionString;
SqlConnection con = new SqlConnection(conn);
con.Open();
check:
if (CheckBoxList1.SelectedItem != null)
{
foreach (ListItem l in CheckBoxList1.Items)
{
if (l.Selected)
{
SqlCommand cmd = new SqlCommand("Drop Table " + l, con);
cmd.ExecuteNonQuery();
Label4.ForeColor = Color.Red;
Label4.Text = " PaperSet Deleted successfully";
CheckBoxList1.Items.Remove(l);
papersetlist.Items.Remove(l);
Psetlist.Items.Remove(l);
goto check;
}
}
}
con.Close();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
이것은 삭제 버튼 이벤트 코드입니다.
가지고있는 것처럼 뭔가를 작성해야? 지금까지 가지고있는 샘플 코드를 게시 할 수 있습니까? – nemesv
https://developer.mozilla.org/en-US/docs/DOM/window.confirm –
'사용자가 삭제할 때'와 관련이 있지만 실제로는 JavaScript 솔루션 대신 실제 확인 페이지? 사용자의 클릭 수는 같지만 추가 보안 계층입니다. –