Click here to Skip to main content
15,886,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys i have a message box using client script. Now, i want to refresh the page after the pop up window appear. here is my code.

What I have tried:

ClientScript.RegisterStartupScript(Me.GetType, "alert", "alert('This student record already exist');", True)
Posted
Updated 14-Jan-17 7:23am

1 solution

Just add another line of JavaScript code there,
ClientScript.RegisterStartupScript(Me.GetType, "alert", "alert('This student record already exist');window.location.reload();", True)
 
Share this answer
 
Comments
Member 12919944 16-Jan-17 5:11am    
dude its refreshing . but it doesnt stop refreshing over and over again ?
Afzaal Ahmad Zeeshan 16-Jan-17 6:55am    
That is the because, it will popup the alert, then reload.

You did not share any other logic to execute.
Member 12919944 16-Jan-17 7:29am    
here my code

If quarter.Text = "Quarter1" Then
q1()
ElseIf quarter.Text = "Quarter2" Then
q2()
ElseIf quarter.Text = "Quarter3" Then
q3()
ElseIf quarter.Text = "Quarter4" Then
q4()
End If

ClientScript.RegisterStartupScript(Me.GetType, "alert", "alert('Record Sucessfully Updated');window.location.reload();", True)
Member 12919944 16-Jan-17 7:29am    
i just want one alert and one refresh
Afzaal Ahmad Zeeshan 16-Jan-17 7:39am    
Once the page refreshes, the script will reload. You need to check on the server side to see if the page was refreshed or not. In current code, there is no such check.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900