Pass array from c# code to javascript on page load

Joined
May 4, 2010
Messages
1
Reaction score
0
Hi
i am trying to pass a simple array to be viewed on a javascript news scroller.
i tried to do it with ClientScript.RegisterArrayDeclaration
but it works only when i call the scroller function with a button

and another issue works only when i inserts a specific string like this:

Page.ClientScript.RegisterArrayDeclaration("arr", "TEST1","TEST2")

and not like this

string[] arr = { "test1", "test2" };
Page.ClientScript.RegisterArrayDeclaration("arrP", arr.ToString())

any other way to do this? or fix this way?
please add c# example because i am new to c# ans asp.net
thanks

Doron
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top