[英]How to alert and redirect using sweet alert in asp.net
ScriptManager.RegisterStartupScript(this, this.GetType(),
"alert",
"alert('User details saved successfully');window.location ='frmDisplayUsers.aspx';",
true);
您需要在頁面頂部的SweetAlert庫中添加一個Referene:
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
然后,您需要將代碼更改為此:
ScriptManager.RegisterStartupScript(this, this.GetType(),
"alert",
"swal('User details saved successfully').then((value) => { window.location ='frmDisplayUsers.aspx'; });",
true);
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "swal('Done !!!','User details saved successfully','success').then((value) => { window.location ='frmDisplayUsers.aspx'; });", true);
這就是我想要的.....
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.