hello,
what code would i use to kick off a javascript script after i had
registered it?
If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then
Page.RegisterClientScriptBlock("jsScript", strScript)
End If
looking to kick off a script from inside a codebehind, but
conditionally not on an onClick event.
is there a way to do this?
have also played around with
IsStartupScriptRegistered/RegisterStartupScript
but still not sure of how to call that script from one of my functions
in my codebehind
any help would be apprecaited! thanks 6 1310
Simon,
Please do not start new threads if you did not got answers in the other one.
The sample is there,
Cor
hello, sorry for the bad thread etiquette. thought that my question
would get passed over since there were replies. thanks for the link,
i'm going to check it out now... Simon,
Please do not start new threads if you did not got answers in the other one.
The sample is there,
Cor
you need to look at how asp.net works:
1) server build page html
2) server sends page html to browser
3) browser parses and loads html
your asp.net code runs in step 1
your javascript runs in step 3
with this model, obviously server code can not call client code. there are a
couple a ways to control when the browser runs the client script. the script
can be tied to the browser onload event, a click event, or inline (processed
during page parse). RegisterStartupScript, renders a script block just
before the closing form tag, so it a handly plce to inline script.
-- bruce (sqlwork.com)
"simon" <me@here.com> wrote in message
news:dd********************************@4ax.com... hello, what code would i use to kick off a javascript script after i had registered it?
If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then Page.RegisterClientScriptBlock("jsScript", strScript) End If
looking to kick off a script from inside a codebehind, but conditionally not on an onClick event.
is there a way to do this? have also played around with IsStartupScriptRegistered/RegisterStartupScript but still not sure of how to call that script from one of my functions in my codebehind
any help would be apprecaited! thanks
thanks bruce. i'm getting the clearer picture of client vs server
processing.
regarding inline, that is theoretically what i'm trying to do here
if a condition arrises in the parsing, call a javascript function;
maybe i need to make a little popup window instead of an alert and
call that. once they click Ok send them to the page i originally
intended.
maybe i'm missing the understanding of inline processing. would a vb
fucntion call (based on an event) be considered inline processing? you need to look at how asp.net works:
1) server build page html 2) server sends page html to browser 3) browser parses and loads html
your asp.net code runs in step 1 your javascript runs in step 3
with this model, obviously server code can not call client code. there are a couple a ways to control when the browser runs the client script. the script can be tied to the browser onload event, a click event, or inline (processed during page parse). RegisterStartupScript, renders a script block just before the closing form tag, so it a handly plce to inline script.
-- bruce (sqlwork.com)
"simon" <me@here.com> wrote in message news:dd********************************@4ax.com.. . hello, what code would i use to kick off a javascript script after i had registered it?
If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then Page.RegisterClientScriptBlock("jsScript", strScript) End If
looking to kick off a script from inside a codebehind, but conditionally not on an onClick event.
is there a way to do this? have also played around with IsStartupScriptRegistered/RegisterStartupScript but still not sure of how to call that script from one of my functions in my codebehind
any help would be apprecaited! thanks
no.
<html>
<body>
<script>
// inline javascript - executed during page parse by browser
document.write("<input type=button onclick='btnClick()'>");
// javascript function executed by user event
function btnClick()
{
alert("clicked button");
}
</script>
</body>
</htm>
-- bruce (sqlwork.com)
"simon" <me@here.com> wrote in message
news:g8********************************@4ax.com... thanks bruce. i'm getting the clearer picture of client vs server processing. regarding inline, that is theoretically what i'm trying to do here if a condition arrises in the parsing, call a javascript function; maybe i need to make a little popup window instead of an alert and call that. once they click Ok send them to the page i originally intended. maybe i'm missing the understanding of inline processing. would a vb fucntion call (based on an event) be considered inline processing?
you need to look at how asp.net works:
1) server build page html 2) server sends page html to browser 3) browser parses and loads html
your asp.net code runs in step 1 your javascript runs in step 3
with this model, obviously server code can not call client code. there are a couple a ways to control when the browser runs the client script. the script can be tied to the browser onload event, a click event, or inline (processed during page parse). RegisterStartupScript, renders a script block just before the closing form tag, so it a handly plce to inline script.
-- bruce (sqlwork.com)
"simon" <me@here.com> wrote in message news:dd********************************@4ax.com. .. hello, what code would i use to kick off a javascript script after i had registered it?
If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then Page.RegisterClientScriptBlock("jsScript", strScript) End If
looking to kick off a script from inside a codebehind, but conditionally not on an onClick event.
is there a way to do this? have also played around with IsStartupScriptRegistered/RegisterStartupScript but still not sure of how to call that script from one of my functions in my codebehind
any help would be apprecaited! thanks
thanks for clarifying no.
<html> <body> <script>
// inline javascript - executed during page parse by browser
document.write("<input type=button onclick='btnClick()'>");
// javascript function executed by user event
function btnClick() { alert("clicked button"); } </script> </body> </htm>
-- bruce (sqlwork.com) "simon" <me@here.com> wrote in message news:g8********************************@4ax.com.. . thanks bruce. i'm getting the clearer picture of client vs server processing. regarding inline, that is theoretically what i'm trying to do here if a condition arrises in the parsing, call a javascript function; maybe i need to make a little popup window instead of an alert and call that. once they click Ok send them to the page i originally intended. maybe i'm missing the understanding of inline processing. would a vb fucntion call (based on an event) be considered inline processing?
you need to look at how asp.net works:
1) server build page html 2) server sends page html to browser 3) browser parses and loads html
your asp.net code runs in step 1 your javascript runs in step 3
with this model, obviously server code can not call client code. there are a couple a ways to control when the browser runs the client script. the script can be tied to the browser onload event, a click event, or inline (processed during page parse). RegisterStartupScript, renders a script block just before the closing form tag, so it a handly plce to inline script.
-- bruce (sqlwork.com)
"simon" <me@here.com> wrote in message news:dd********************************@4ax.com ... hello, what code would i use to kick off a javascript script after i had registered it?
If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then Page.RegisterClientScriptBlock("jsScript", strScript) End If
looking to kick off a script from inside a codebehind, but conditionally not on an onClick event.
is there a way to do this? have also played around with IsStartupScriptRegistered/RegisterStartupScript but still not sure of how to call that script from one of my functions in my codebehind
any help would be apprecaited! thanks
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: nerf |
last post by:
How can I execute a javascript file(test.js) from within PHP. I'm running
oscommerce and want to insert a menu created in javascript by Sothink
DHTMLMenu. Thanks in advance
|
by: paul dallaire |
last post by:
HI! I want to execute a link witch is in JavaScript, How do we execute this
in asp server side if possible?
Basically I don't want anyone to see this link in the code view.
this is the link...
|
by: jm |
last post by:
I have a parent window:
<script language="javascript">
function doSearch() {
result=showModalDialog("searchmni.aspx?lastname=smith");
alert(result);
}
</script>
|
by: Scott Natwick |
last post by:
Is there a way to execute a JavaScript from the Page_Load event?
Or alternatively, is there a way to have it execute when the page is loaded?
I am defining the script in the Page_Load event and...
|
by: Ian Kelly |
last post by:
Hi All,
I have an .net form that is split into two frames. The left frame has a
tree that displays a list of all the customers. The right frame displays
the appropriate clients information. ...
|
by: batham |
last post by:
Hi Gurus,
How can I execute a script during runtime. Here is my code, so how do I
execute the new script during runtime which should be a part of the
'topDiv'.
Thanks Help is appreciated.
-...
|
by: simon |
last post by:
hello,
what code would i use to kick off a javascript script after i had
registered it?
If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then
Page.RegisterClientScriptBlock("jsScript",...
|
by: oliver |
last post by:
QUESTION: How to access an object embedded in a UserControl through
Javascript file?
Another way to ask this question: How to execute script from a UserControl,
accessing other objects in that...
|
by: Manfred Kooistra |
last post by:
If I have a document like this:
<html>
<head>
<script language=javascript>
window.location.href='file.php';
</script>
</head>
<body>
body content
|
by: pablosuk78 |
last post by:
Dear coders,
I'm facing a problem and after few research I found that many ppl were looking around for the same solution, hope someone more expert than me could give a good help.
I created an...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |