Solved

ClientScript.RegisterClientScriptBlock not working inside updatepanel

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Suggested Courses

734 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