Solved

ClientScript.RegisterClientScriptBlock not working inside updatepanel

Posted on 2011-02-15
4
1,244 Views
Last Modified: 2012-08-13
I have some code that uses :
ClientScript.RegisterClientScriptBlock(Me.GetType(), "PopUpwindowOpenx", strScript) in my code behind.

This works fine.

When I put the page inside an update panel this code stops working.

I have tried replacing with:
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType, "PopUpwindowOpenx", strScript, True)

It still doesn't work.

What am I doing wrong with the new line?
0
Comment
Question by:scm0sml
  • 3
4 Comments
 
LVL 16

Expert Comment

by:BurnieP
Comment Utility
Hi,

You can try using ScriptManager.RegisterStartupScript.

ScriptManager.RegisterStartupScript(Page, Me.GetType, "PopUpwindowOpenx", strScript, True)
0
 

Author Comment

by:scm0sml
Comment Utility
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Wed, 16 Feb 2011 10:30:52 UTC


Message: Syntax error
Line: 60836993
Char: 1
Code: 0
URI: http://localhost:3376/ImportPayments/SupplierSearch.aspx?textbox=ctl00$maincontent$ucInvoiceHeader$txtSuppOnInv&hiddenid=ctl00$maincontent$ucInvoiceHeader$hdnSuppOnInv&hiddentype=ctl00$maincontent$ucInvoiceHeader$hdnSuppOnInvType&hiddenpayeetype=ctl00$maincontent$ucInvoiceHeader$hdnPayeeType&hiddenpayeeid=ctl00$maincontent$ucInvoiceHeader$hdnPayeeID&hiddenpayeetxt=ctl00$maincontent$ucInvoiceHeader$txtPayeeName&setpayee=true&setsupplier=true

All the code on the page works fine without the update panel etc so I think this error is related to your suggestion.

Any ideas?
0
 

Accepted Solution

by:
scm0sml earned 0 total points
Comment Utility
This worked for me:
ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType, "DisplayAlertAJ", script, True)
0
 

Author Closing Comment

by:scm0sml
Comment Utility
Answered it myself.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now