473,385 Members | 2,044 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,385 software developers and data experts.

RegisterStartUpScript

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
Jun 27 '08 #1
1 1360
ClientScript.RegisterStartupScript add it script right after the <form
runat=servertag. 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)
"BillGatesFan" wrote:
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
Jun 27 '08 #2

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

Similar topics

3
by: Lukman | last post by:
Hi, Could you tell me about what is RegisterStartupScript, I try to understand from MSDN sample, but I still don't understand. Could you give me more simple sample ? and what is the purpose of...
6
by: Bill Jones | last post by:
I'm trying to use this.RegisterStartupScript to add some javascript to and aspx page that will run when the page is loaded. Does anyone know if this function only works in the Page_Load function? ...
11
by: Stan Sainte-Rose | last post by:
Hi, I m working on a user control. I need to use a Js file, I would like to know how to load the js file using RegisterStartupScript command from the user control. Also, if I load the same user...
3
by: Mike | last post by:
Hi, I am trying to resize a HTML table through Javascript. When the user control loads the first time, the table is resized, but then it doesn't anymore. I am using the following code in the...
2
by: Marshal Antony | last post by:
Hi, I have a problem with using Page.RegisterStartupScript to call some javascript code from ASP.NET using C# is not working in Netscape.It is working fine in Internet Explorer.Does anybody know...
0
by: rom | last post by:
my main aspx page has 3 user controls. they are all located in the same place of the page and each time i set the visibility of 2 of them to false and 1 to true. now, i want to use the...
7
by: sck10 | last post by:
Hello, I have the following sub in a class in my "App_Code" directory. The script is for setting focus on a particular control, but I get the error, "Name ClientScript Not declared". Also, I am...
3
by: MJP | last post by:
I have a button which kicks off the generation of a report after which the file will be downloaded. The report generation can take a long time, so client side onclick event of the button also...
3
by: Rob | last post by:
Hi, We've developed an ajax enabled web app which we're currently deploying to our production server. We use System.Web.UI.Page.RegisterStartupScript throughout the app, and all has worked well...
4
by: =?Utf-8?B?RHVuZTg4?= | last post by:
I've got some code that uses Page.ClientScript.RegisterStartupScript to call a javascript function from the Page_Load method in the code behind. The code works fine in IE but the javascript...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.