window.open in the postback?

J

Jose

Hello,

Anyone have some advice on opening up windows as the
result of postback processing in a control? (best
practice, avoid javascript, etc..sort of thing)

PROBLEM: from a custom asp.net application, inside my
composite custom webcontrol, on a aspx page, a click of a
button should call a webservice to render a report to
another browser window. Note: there are 2 ways to render
from the report server: (1) get bytestream of, say a PDF,
and build a HTTP response with the bytestream, or (2)
send a HTTP POST of the report url to the server asking
it to render.

SOLUTIONS (3). I see #1 as the most usable. Does anyone
else have a good solution or insight?

(1) Render in the request's response

//first..render the report using SRS's Render method
//then, return the bytestream in the response
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ClearContent();
if (contentType == null)
HttpContext.Current.Response.ContentType
= "application/octet-stream";
else
HttpContext.Current.Response.ContentType = contentType;
HttpContext.Current.Response.AppendHeader("Content-
Disposition", "attachment; filename=\"test.pdf\"");
HttpContext.Current.Response.BinaryWrite(content);
HttpContext.Current.Response.End();

Problems:
(a) renders to the same window as your app. would like it
to render to a separate window.

(2) in the "render" button's postback, inject some
javascript in the response to window.open a new window to
another aspx page whose sole purpose is to issue a http
post to SRS, or Render in combo with #1

Problems:
(a) i've read that it's not good to make any
functionality in your app <<depend>> on javascript...esp.
the kind that pops up windows blocked by some ad blockers.


(3) use a hyperlink's navigateurl to javascript open to
the http url of the report

Problems:
(a) this is http get...need POST due to long params.
(b) use of javascript again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top