RegisterStartUpScript

B

BillGatesFan

If I click a button and have a function that registers a startup
script like
button_click event:

ClientScript.RegisterStartupScript(GetType(Page), "gArray", "var
DAddresses = new Array(1,2,3);", True)



Then I have in my head tag


<script type="text/javascript">

var DAddresses = null;
function initialize() {
alert(DAddresses);
if (DAdresses)
showAddress(DAddresses);

}

function showAddress(address) {
alert(address);
....
}
</script>


I'm trying to create an javascript array on the server to be used by
my client-side javascript on postback
 
B

bruce barker

ClientScript.RegisterStartupScript add it script right after the <form
runat=server> tag. this means that function and variables are not available
to inline code in the <head>. your client javascript should not access server
generated code until onload.


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top