Response.write() inside update panel errors out

ohmErnie used Ask the Experts™
I am working on an ASP.NET page and I have 5 image buttons inside an UpdatePanel control. The image buttons are thumbnails and I want them to open up a new window with the original images. I have the url set for the image, but every time I try to do a response.write("<script>, _blank)</script") I get an error saying "Sys.WebForms.PageRequestManagerParserErrorException: The message recieved from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write()"

Why won't it let me alter the response.write? Is there any other way to open the url in a new window?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
you don't want to write directly to the response stream, what you need to do is find another way to inject that bit of javascript into the page. you could do this by adding a literal control to the page and then setting it's text value to the javascript.
or alternativey use page.RegisterStartupScript (.net 1.1) or ClientScript.RegisterStartupScript (.net 2.0)


Does the literal control have to be inside or outside of the UpdatePanel? I tried setting an invisible label's text to the javascript, but no luck.

I also tried using the RegisterStartupScript and nothing happened.
if the label is set to invisible then it won't be written to the output stream, try making the literal visible again.
Forced accept.

EE Admin

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial