Resources » Code Snippets » ASP.NET WebForms

RegisterStartupScript while using AJAX Update Panel


Last Updated:   Category: ASP.NET WebForms    
Author: Member Level: Gold    Points: 10



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)



Did you like this resource? Share it with your friends and show your love!

Responses to "RegisterStartupScript while using AJAX Update Panel"
Author: Sabarees    04 Jul 2008Member Level: Gold   Points : 1
hi Vanitha,

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

Regards
Sabarees



Author: Lion    13 Nov 2009Member 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.


try
{


}
catch(exception ex)

{

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


}






Feedbacks      

Post Comment:




  • 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:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Phagu Mahato
    More...
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India