473,657 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.performc lick?

Thanks
Jul 21 '05 #1
4 4779
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="windo w.open('fileToO pen')) or send this code to the client-side
control from the server side:

Page_Load()
Button2.Attribu tes.Add("onClic k","window.open ('fileToOpen')" )
End Sub


"yfng" <yf**@discussio ns.microsoft.co m> wrote in message
news:26******** *************** ***********@mic rosoft.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.performc lick?

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.attribut e.add("onclick" , "javascript:win dow.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="windo w.open('fileToO pen')) or send this code to the client-side
control from the server side:

Page_Load()
Button2.Attribu tes.Add("onClic k","window.open ('fileToOpen')" )
End Sub


"yfng" <yf**@discussio ns.microsoft.co m> wrote in message
news:26******** *************** ***********@mic rosoft.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.performc lick?

Thanks


Jul 21 '05 #3
How about having one .aspx page run your server code and when they are done,
simply use response.redire ct or server.transfer to call another server page
that includes the button with the onClick event handler?
"yfng" <yf**@discussio ns.microsoft.co m> wrote in message
news:E3******** *************** ***********@mic rosoft.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.attribut e.add("onclick" , "javascript:win dow.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="windo w.open('fileToO pen')) or send this code to the client-side
control from the server side:

Page_Load()
Button2.Attribu tes.Add("onClic k","window.open ('fileToOpen')" )
End Sub


"yfng" <yf**@discussio ns.microsoft.co m> wrote in message
news:26******** *************** ***********@mic rosoft.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.performc lick?
>
> 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.redire ct or server.transfer to call another server page
that includes the button with the onClick event handler?
"yfng" <yf**@discussio ns.microsoft.co m> wrote in message
news:E3******** *************** ***********@mic rosoft.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.attribut e.add("onclick" , "javascript:win dow.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="windo w.open('fileToO pen')) or send this code to the client-side
control from the server side:

Page_Load()
Button2.Attribu tes.Add("onClic k","window.open ('fileToOpen')" )
End Sub


"yfng" <yf**@discussio ns.microsoft.co m> wrote in message
news:26******** *************** ***********@mic rosoft.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.performc lick?
>
> Thanks


Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3936
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 when I try to scroll the records the code runs. The subform is continuous; all the controls are on one line and the detail section is not exsposed above or below the controls. I tried coding the detail Click event but nothing happened. I tried...
5
6812
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 rather than actually clicking the search button, but this does not run the search code behind the button.
11
13916
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 all users (btnSendAll). When user hits enter, I also simulate the effect of clicking button (btnSend). However, what I found btnSend doesn't fire (unless I click on the button). The postback function I call is as follows: function...
3
8787
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 twice, once with postback true, and second time without postback. This only happens for this button. How can I sort out this issue, any clues what to look for to get this sorted please. <p>Search Bookmarks: <asp:TextBox ID="txtSearch"...
41
4288
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 on some initialization information obtained elsewhere. Basically, I'm going to create my own dynamic toolbar where the toolbarbuttons can change. I'm not using the VB toolbar because of limitations in changing things like backcolor (I can't get...
0
2945
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 such as when they do a delete. Everything is great. By and large it will be used in my repeater controls using the command event when the user clicks on it and so that event is working great. My issue is the Click event. When the control is...
21
8139
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 if I could place a hidden button in a frame that would have the attribute to refresh the other. I would need code to "invoke" the onclick event (ie i need code to click the button). is this possible? thanks.
6
2802
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) ... something like button2.click ??? Thanks for help ..
7
6860
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, it is not work, anyone can tell how to use button click event ? Thanks in advance, Martin
1
7004
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 page has multiple button such login page with a search function somewhere around, then it's not respond properly. I have attached a brief example of two text boxes and two button. When ever a key is press on textbox one, I want to trigger...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1611
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.