Как предупредить и перенаправить с помощью сладкого оповещения в asp.net - PullRequest
0 голосов
/ 19 ноября 2018
ScriptManager.RegisterStartupScript(this, this.GetType(), 
"alert", 
"alert('User details saved successfully');window.location ='frmDisplayUsers.aspx';", 
true);

Ответы [ 2 ]

0 голосов
/ 09 июля 2019
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "swal('Done !!!','User details saved successfully','success').then((value) => { window.location ='frmDisplayUsers.aspx'; });", true);

это было то, что я хотел .....

0 голосов
/ 19 ноября 2018

Вам необходимо добавить референ в библиотеку 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);
...