How to get alert message before redirect a page

前端 未结 7 1244
面向向阳花
面向向阳花 2020-12-25 07:49

I\'m using vs 2010. I need to display the message to user and redirect the page.

I use the below line.

ScriptManager.RegisterStartupScript(this, this         


        
7条回答
  •  悲哀的现实
    2020-12-25 08:45

    You need to write:

     ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", " alert('User details saved sucessfully'); window.open('frmDisplayUsers.aspx');", true);
    

    Please note that I have removed the script tags as the last parameter true means you must not use the script tag.

    This code worked for me. If you have any problem let me know. In addition you can use setTimeout to delay the window open that might not be a very bad choice.

提交回复
热议问题