471,348 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

click button

In a web form, I want the user clicks on one button and this button will
trigger another button/link which will open a new browser window? How to do
that? Is there any method like
Button.performclick?

Thanks
Jul 21 '05 #1
4 4495
Opening another browser window is not something you can do from server-side
code. Only the client can control the client. You have 2 questions here so
let me answer them individually.

1. How to call the click event of a button from the click event of another
button: This is accomplished by simply placing a call to the click event
handler of the second button in the first:

Sub Button1_Click() Handles Button1.Click
'Call the click event handler of button2
Button2_Click()
End Sub

Sub Button2_Click() Handles Button2.Click
'Button2's click event code here
End Sub

2. How to open a new browser window. As stated, only client-side code
(JavaScript) can do this, so you either have to embed a client-side script
and add a client-side event handler to a button
(onClick="window.open('fileToOpen')) or send this code to the client-side
control from the server side:

Page_Load()
Button2.Attributes.Add("onClick","window.open('fil eToOpen')")
End Sub


"yfng" <yf**@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
In a web form, I want the user clicks on one button and this button will
trigger another button/link which will open a new browser window? How to
do
that? Is there any method like
Button.performclick?

Thanks

Jul 21 '05 #2
Thanks.
But the problem is that... I want to ensure that some server scripts will
run before another browser window opens... For the
button.attribute.add("onclick", "javascript:window.open")... It seems that it
cannot gurantee this ...

"Scott M." wrote:
Opening another browser window is not something you can do from server-side
code. Only the client can control the client. You have 2 questions here so
let me answer them individually.

1. How to call the click event of a button from the click event of another
button: This is accomplished by simply placing a call to the click event
handler of the second button in the first:

Sub Button1_Click() Handles Button1.Click
'Call the click event handler of button2
Button2_Click()
End Sub

Sub Button2_Click() Handles Button2.Click
'Button2's click event code here
End Sub

2. How to open a new browser window. As stated, only client-side code
(JavaScript) can do this, so you either have to embed a client-side script
and add a client-side event handler to a button
(onClick="window.open('fileToOpen')) or send this code to the client-side
control from the server side:

Page_Load()
Button2.Attributes.Add("onClick","window.open('fil eToOpen')")
End Sub


"yfng" <yf**@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
In a web form, I want the user clicks on one button and this button will
trigger another button/link which will open a new browser window? How to
do
that? Is there any method like
Button.performclick?

Thanks


Jul 21 '05 #3
How about having one .aspx page run your server code and when they are done,
simply use response.redirect or server.transfer to call another server page
that includes the button with the onClick event handler?
"yfng" <yf**@discussions.microsoft.com> wrote in message
news:E3**********************************@microsof t.com...
Thanks.
But the problem is that... I want to ensure that some server scripts will
run before another browser window opens... For the
button.attribute.add("onclick", "javascript:window.open")... It seems that
it
cannot gurantee this ...

"Scott M." wrote:
Opening another browser window is not something you can do from
server-side
code. Only the client can control the client. You have 2 questions here
so
let me answer them individually.

1. How to call the click event of a button from the click event of
another
button: This is accomplished by simply placing a call to the click event
handler of the second button in the first:

Sub Button1_Click() Handles Button1.Click
'Call the click event handler of button2
Button2_Click()
End Sub

Sub Button2_Click() Handles Button2.Click
'Button2's click event code here
End Sub

2. How to open a new browser window. As stated, only client-side code
(JavaScript) can do this, so you either have to embed a client-side
script
and add a client-side event handler to a button
(onClick="window.open('fileToOpen')) or send this code to the client-side
control from the server side:

Page_Load()
Button2.Attributes.Add("onClick","window.open('fil eToOpen')")
End Sub


"yfng" <yf**@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
> In a web form, I want the user clicks on one button and this button
> will
> trigger another button/link which will open a new browser window? How
> to
> do
> that? Is there any method like
> Button.performclick?
>
> Thanks


Jul 21 '05 #4
Thanks.

"Scott M." wrote:
How about having one .aspx page run your server code and when they are done,
simply use response.redirect or server.transfer to call another server page
that includes the button with the onClick event handler?
"yfng" <yf**@discussions.microsoft.com> wrote in message
news:E3**********************************@microsof t.com...
Thanks.
But the problem is that... I want to ensure that some server scripts will
run before another browser window opens... For the
button.attribute.add("onclick", "javascript:window.open")... It seems that
it
cannot gurantee this ...

"Scott M." wrote:
Opening another browser window is not something you can do from
server-side
code. Only the client can control the client. You have 2 questions here
so
let me answer them individually.

1. How to call the click event of a button from the click event of
another
button: This is accomplished by simply placing a call to the click event
handler of the second button in the first:

Sub Button1_Click() Handles Button1.Click
'Call the click event handler of button2
Button2_Click()
End Sub

Sub Button2_Click() Handles Button2.Click
'Button2's click event code here
End Sub

2. How to open a new browser window. As stated, only client-side code
(JavaScript) can do this, so you either have to embed a client-side
script
and add a client-side event handler to a button
(onClick="window.open('fileToOpen')) or send this code to the client-side
control from the server side:

Page_Load()
Button2.Attributes.Add("onClick","window.open('fil eToOpen')")
End Sub


"yfng" <yf**@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
> In a web form, I want the user clicks on one button and this button
> will
> trigger another button/link which will open a new browser window? How
> to
> do
> that? Is there any method like
> Button.performclick?
>
> Thanks


Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Sally | last post: by
5 posts views Thread by Steve | last post: by
11 posts views Thread by CW | last post: by
3 posts views Thread by Imran Aziz | last post: by
reply views Thread by Demetri | last post: by
6 posts views Thread by user | last post: by
7 posts views Thread by =?Utf-8?B?bWFydGluMQ==?= | last post: by
reply views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.