Solved

ClientScript.RegisterClientScriptBlock not working inside updatepanel

Posted on 2011-02-15
4
1,319 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 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