473,322 Members | 1,398 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,322 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 4729
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.