473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 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 4751
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Sally | last post by:
I need to be able to click in a subform and run code but at the same time I need to be able to scroll the records without running the code. I tried coding the Enter event of the subform control but...
5
by: Steve | last post by:
Hi, Is it possible to make hitting the enter key in an ASP textbox run the code behind an ASP button on a form? I have a search page which users tend to type in the query then just hit enter...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
3
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
0
by: Demetri | last post by:
I have created a web control that can be rendered as either a linkbutton or a button. It is a ConfirmButton control that allows a developer to force a user to confirm if they intended to click it...
21
by: Ben | last post by:
Hello I have frames set up in an asp.net application and need one frame to refresh another. Seeing as events need to be registered at the time the page is sent from the server, I was wondering...
6
by: user | last post by:
Hello, With ASP.NET2, how to program a button's click ? For example, I have two button and when i click the first one, i would like that the second one will be click too (by programming) ......
7
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
Hi, All, I create button in the code ( Dim Button as new Button), not using button web component (means not drap button and drop it ont he webform), after that I try to use button_click event,...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.