Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Button Click handler to Spawn Window

Reply
Thread Tools

Button Click handler to Spawn Window

 
 
Thom Little
Guest
Posts: n/a
 
      08-22-2004
I am looking for a button click event handler that will open a new window
and transfer control to it. This will be similar to target=_blank
processing for a hyperlink control but using a button control in its place.

What was the source of your information?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--



 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      08-22-2004
Hey Thom,

This is client-side stuff so, everything is built for you. How about
something like this?

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Button1.Attributes.Add _
("onclick", "var newwin = window.open" & _
"('http://www.gc.ca/','_blank');newwin.focus();")
End Sub

Ken
Microsoft MVP [ASP.NET]
Toronto



"Thom Little" <> wrote in message
news:%23hq$...
>I am looking for a button click event handler that will open a new window
>and transfer control to it. This will be similar to target=_blank
>processing for a hyperlink control but using a button control in its place.
>
> What was the source of your information?
>
> --
> -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
> --
>
>
>


 
Reply With Quote
 
 
 
 
Thom Little
Guest
Posts: n/a
 
      08-23-2004
Excellent ... almost ...

Your technique does spawn a new window and transfer control to it. The
"_none" is unneeded. If not present it defaults to "_none". The
"newwin.focus( )" is not needed since focus is set to the new window
automatically.

I can not find a way to have it load the new window into the same window as
the caller (the "_self" option seems to have no affect and the request is
seemingly ignored).

Any ideas?

(The reason I am doing this is that I have about 40 buttons on a page to
call other existing pages. I would like to add an option of
"spawn/no-spawn" to let the user select the mode they want to run.
"no-spawn" would use the existing window. "spawn" would create a new window
and use it.)

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

"Ken Cox [Microsoft MVP]" <> wrote in message
news:%...
> Hey Thom,
>
> This is client-side stuff so, everything is built for you. How about
> something like this?
>
> Private Sub Page_Load _
> (ByVal sender As System.Object, _
> ByVal e As System.EventArgs) _
> Handles MyBase.Load
> Button1.Attributes.Add _
> ("onclick", "var newwin = window.open" & _
> "('http://www.gc.ca/','_blank');newwin.focus();")
> End Sub
>
> Ken
> Microsoft MVP [ASP.NET]
> Toronto
>
>
>
> "Thom Little" <> wrote in message
> news:%23hq$...
>>I am looking for a button click event handler that will open a new window
>>and transfer control to it. This will be similar to target=_blank
>>processing for a hyperlink control but using a button control in its
>>place.
>>
>> What was the source of your information?
>>
>> --
>> -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
>> --
>>
>>
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logging stdout/stderr/stdin of an spawn process (Open4::spawn) Edgardo Hames Ruby 1 05-06-2008 08:17 PM
Logging stdout/stderr/stdin of an spawn process (Open4::spawn) Ed Hames Ruby 0 04-16-2008 04:21 PM
spawn syntax + os.P_WAIT mode behavior + spawn stdout redirection Derek Basch Python 2 01-21-2005 05:37 AM
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net 2 05-25-2004 11:45 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57