Hi @Gani_tpt,
There is a problem with the following line of code. The way you wrote it is wrong.
window.location='window.close();'
The window.location
object can be used to get the current page address (URL) and to redirect the browser to a new page.
Window close()
:closes a window.
The two should not be used together.
If you want to use window.location, you can use window.location.href to return the href (URL) of the current page.
Dim Msg As String
Msg = "Rec. updated successfully."
System.Web.UI.ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType(), "ClosePopup", "alert('" + Msg + "');window.location.href = 'https://localhost:44395/WebForm2';", True)
Or you can close the ASP.NET modal popup directly:
Dim Msg As String
Msg = "Rec. updated successfully."
System.Web.UI.ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType(), "ClosePopup", "alert('" + Msg + "');$('#YOURModalID').modal('hide');", True)
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.