Solved

ClientScript.RegisterClientScriptBlock not working inside updatepanel

Posted on 2011-02-15
4
1,272 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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

831 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