Home All Groups Group Topic Archive Search About
Author
18 Apr 2005 5:59 AM
Jack
Hi,

How do I open a new window in a button click event (server-side)?

I need to open it from this event because once the user has click the
button, the event handler does some processing and creates a query
string.

If I didn't need the query string it wouldn't be a problem - I would
just use javascript client-side.

e.g.

Private Sub PreviewButton_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles PreviewButton.Click

-process data

-create query string

-open new page with query string

End Sub

I have tried adding this:
PreviewButton.Attributes.Add("onclick",
"window.open('somedoc.html','somename',
'width=150,height=150,resizable=1)")

and this:

Response.Write("<script
language=javascript>window.open('somedoc.html',' new')</script>")

without luck!

Thanks,
Jack

Author
18 Apr 2005 7:55 AM
Steve C. Orr [MVP, MCSD]
This article shows how to use javascript in your pages, including
window.open.
http://SteveOrr.net/articles/clientsidesuite.aspx

Here's more info:
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp

Some popup blockers may foil your plans however, so consider alternate
designs.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


Show quoteHide quote
"Jack" <jac***@humlog.com> wrote in message
news:6ea814a3.0504172159.6e3913a@posting.google.com...
> Hi,
>
> How do I open a new window in a button click event (server-side)?
>
> I need to open it from this event because once the user has click the
> button, the event handler does some processing and creates a query
> string.
>
> If I didn't need the query string it wouldn't be a problem - I would
> just use javascript client-side.
>
> e.g.
>
> Private Sub PreviewButton_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles PreviewButton.Click
>
> -process data
>
> -create query string
>
> -open new page with query string
>
> End Sub
>
> I have tried adding this:
> PreviewButton.Attributes.Add("onclick",
> "window.open('somedoc.html','somename',
> 'width=150,height=150,resizable=1)")
>
> and this:
>
> Response.Write("<script
> language=javascript>window.open('somedoc.html',' new')</script>")
>
> without luck!
>
> Thanks,
> Jack