Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

The below code block is not working after adding an update panel:\
Dim myscript As String = "alert('Please Enter Quantity');"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "myscript", myscript, True)


Any help is greatly appreciated.

Ganesh.S
Posted
Updated 3-Jun-11 0:08am
v2
Comments
gani7787 3-Jun-11 7:47am    
Hi,

I am getting the new error while using the below code.

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: The script tag registered for type 'ASP.addconsumables_aspx' and key 's2' has invalid characters outside of the script tags: <SCRIPT language=alert('Please Enter Quantity');

1 solution

While using update panel and script manger, you need to register script to script manger and not to the page.

look below code.

VB
Dim s2 As String = "<SCRIPT language='javascript'>"
            s2 = s2 & "alert('Please Enter Quantity');"
            s2 = s2 & " </script>"
            ScriptManager.RegisterStartupScript(Me, Me.GetType, "savedt", s2, False)
 
Share this answer
 
Comments
thatraja 3-Jun-11 12:32pm    
Spot on, 5!

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