Solved

ClientScript.RegisterClientScriptBlock not working inside updatepanel

Posted on 2011-02-15
4
1,260 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
ID: 34902173
Hi,

You can try using ScriptManager.RegisterStartupScript.

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

Author Comment

by:scm0sml
ID: 34905319
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
ID: 35832926
This worked for me:
ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType, "DisplayAlertAJ", script, True)
0
 

Author Closing Comment

by:scm0sml
ID: 35872693
Answered it myself.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
File Upload Control on a ASP.NET Overlay Page 1 43
Handle null when using linq in this line 1 27
error on the asp.net page 1 34
Receiving a string from a WebService Push 21 39
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

21 Experts available now in Live!

Get 1:1 Help Now