473,508 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Activating JavaScript from C#

Mission impossible?

I would like to click on a button on an aspx page, have that trigger a
section of code in the code behind, then depending of the results of the
code behind execution, execute a JavaScript.

The JavaScript I need to execute is a "window.open", but only if the results
of the code execute as expected.

I believe I could dynamically create the JavaScript in the code behind and
add it using RegisterStartupScript. That would allow me to conditinally
execute the JavaScript. In other words, I could simply add blank function
if I needed to not open the window.

However, how could I trigger it to execute on the button click after
executing a call back function?

Any ideas?

Thanks,
Scott
Nov 19 '05 #1
2 3242
WJ
"Mike Strauss" <no**********@yahoo.com> wrote in message
news:aY********************@comcast.com...
Mission impossible?

However, how could I trigger it to execute on the button click after
executing a call back function?


JS is client code, not server code, therefore, the "button click" must also
be client control in order for the JS event to be triggered, not server
control. So my guess here is that you would use the Html Form control button
instead, and assign the JS onButtonClick event to the Html form control
(button). Then on PageLoad event, just register the JS events and you are
good to go.

John
Nov 19 '05 #2
-----Original Message-----
Mission impossible?

I would like to click on a button on an aspx page, have that trigger asection of code in the code behind, then depending of the results of thecode behind execution, execute a JavaScript.

The JavaScript I need to execute is a "window.open", but only if the resultsof the code execute as expected.

I believe I could dynamically create the JavaScript in the code behind andadd it using RegisterStartupScript. That would allow me to conditinallyexecute the JavaScript. In other words, I could simply add blank functionif I needed to not open the window.

However, how could I trigger it to execute on the button click afterexecuting a call back function?

Any ideas?

Thanks,
Scott
.

I suppose it's possible.

1. Create label control, lblScript.
2. Create button, btnOpenWindow
3. In btnOpenWindow_Click
if(condition){
lblScript.Text = Script command
}
else{
lblScript.Text = "";
}
Hope it's helpful

Elton Wang
el********@hotmail.com

Nov 19 '05 #3

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

Similar topics

1
2472
by: Ole Kramer, SFS GmbH | last post by:
We have installed PHP 5.0.1 on a Windows 2003 Server with IIS6 in ISAPI mode. The processing of .php files works fine with our basis version of the php.ini file. But, as soon as we edit the php.ini...
3
11588
by: Maria Bitsku | last post by:
How do I deactivate a window using Javascript. For example if I have a window that opens up another window, how do I prevent the user from clicking (doing anything) in the original window until...
1
2652
by: Jeppe 1971 | last post by:
Hi Does anyone know of a way to load a HTML-page and examine the document without activating the code? I am trying to create a search-function in javascript. The idea is that the function...
1
1599
by: Patrick_Montana | last post by:
I am having a problem auto-activating a macro when I change data in a field on a form that is a combo box. I have a fair understanding of Microsoft Access but am not a programmer so I am trying to...
0
1373
by: Robert Rotstein | last post by:
I want to write a SOAP extension that gets activated from both the client and the server. From whast I have read, this should be quite easy to do. Yet I can only activate it from the server. I...
0
1319
by: Robert Rotstein | last post by:
I want to write a SOAP extension that gets activated from both the client and the server. But so far, I have only been able to activate from the server. I have a service (.asmx file) which...
12
3757
by: ppcguy | last post by:
i've got a link that i give focus to via accesskey. <a href="blah" accesskey=p> in IE, that just gives it focus, but does not activate it. how do i activate the link. thx.
10
4048
by: Carlos Araya | last post by:
I have the following link on a web page <p class="menuitem"><a href="#" onclick="loadFragment('http://rivendellweb.net/fortress/home', 'index')" title="The Fortress Home">The Fortress...
3
1570
by: DanaBulpett | last post by:
How can I activate an item in the toolbar from javascript as if the user had clicked on that item? Thanks in advance
0
7226
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
7328
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,...
1
7049
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
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5055
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...
0
3199
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...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
422
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...

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.