ScriptManager.RegisterStartupScript(this, this.GetType(),
"alert",
"alert('User details saved successfully');window.location ='frmDisplayUsers.aspx';",
true);
最佳答案
您需要在页面的 head 部分添加对 SweetAlert 库的引用:
<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);
关于javascript - 如何在 ASP.NET 中使用 Sweet Alert 进行警报和重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53371850/