RegisterStartupScript while using AJAX Update Panel

If the update panel is used in the page then there must be a problem while using the RegisterStartupScript in code behind. In this case we don't need the "
ClientScript.RegisterStartupScript(Me.GetType, "msgstr", Msg1)

RegisterStartupScript in code behind(Update Panel is used)

Dim Msg2 As String
Msg2 = "alert('Welcome')"
ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), Msg2, True)


Author: Sabarees04 Jul 2008 Member Level: Gold   Points : 1

hi Vanitha,

Really it's a good one. your code was helped me exactly. thank you for posting this.


Author: Lion13 Nov 2009 Member Level: Gold   Points : 2

Hi friends It is really good.
but 1 problem is occured. when this script use in try -Cath block
it is not working..

for ex.


catch(exception ex)


ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), alert('"+ex.message.Tosting()+"'), True)


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: