Hi,
Thanks for the help, after taking about this here, we've decided that we
might have to create a small WIndows Form app which open a mini browser
calling my generate PDF page for each user.
Stephen
"Hans Kesting" wrote:
> > Hi,
> >
> > I'm trying to call a Javascript function within a foreach loop. I am loop
> > over a series of users and I want to call the JS function which opens a new
> > window, passing in the user id to each call for the JS function.
> > So far I've done this:
> >
> > foreach (USER _user in users)
> > {
> > string jscriptString = "<script language='JavaScript'>";
> > jscriptString += "pdfWinOpen(" + _user.userID + ");";
> > jscriptString += "</script>";
> >
> > Response.Write(jscriptString);
> > }
>
> Why a Response.Write? Careful: it doesn't mix well with the regular
> asp.net way of building a page. See Page.RegisterStartupScript for a
> better way. The Response.Write output will end up *before* the regular
> output, where it *might* (not sure) be ignored by the browser.
>
> >
> > But I can't seem to get the javascript to fire. File which opens in the new
> > window has a window.close(); in body onload method. So I easily close the
> > opened window.
>
> So if I understand correctly, that new window closes itself
> immediately?
>
> >
> > How can I fire off the open window JS event?
> >
> > Thanks
> >
> > Stephen
>
> What do you see in the html source of the page that should contain this
> javascript? Does the javascript you expect exist? Does it look OK?
> Any script warnings?
>
> Hans Kesting
>
>
>
|