Empowering the ASP.Net Button Web Control, Confirm?...

1.彈出警示對話框
private void btnEdit_Click(object sender, System.EventArgs e)
{
Page.RegisterStartupScript("Startup", "

1<script language="JavaScript"> alert('" +"warning!" + "') </script>

");
}
2.彈出確定/取消對話框
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
btnDone.Attributes.Add("onclick","return confirm(""+"Continue?"+"");");
}
}

private void btnDone_Click(object sender, System.EventArgs e)
{
//ToDo:.......
}

Published At
Categories with Web编程
Tagged with
comments powered by Disqus