473,406 Members | 2,439 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.

how do you execute javascript after script is regsistered?

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

Jan 31 '06 #1
6 1564
Simon,

Please do not start new threads if you did not got answers in the other one.

The sample is there,

Cor
Jan 31 '06 #2
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


Jan 31 '06 #3
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

Jan 31 '06 #4
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


Jan 31 '06 #5
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

Feb 1 '06 #6
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


Feb 2 '06 #7

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

Similar topics

1
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
4
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...
2
by: jm | last post by:
I have a parent window: <script language="javascript"> function doSearch() { result=showModalDialog("searchmni.aspx?lastname=smith"); alert(result); } </script>
5
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...
4
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. ...
6
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",...
0
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...
31
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
3
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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...
0
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,...

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.