Passing data to use with client javascript

  • Thread starter Alfredo Magallón Arbizu
  • Start date
A

Alfredo Magallón Arbizu

Hello,

I need to pass the contents of a dataset to the client in order to use these
contents with javascript.

What is the best way to achieve that?

Normally I use controls like a grid or text boxes and then I read the values
using javascript objects.

Any other ideas? Greatly appreciated.

Thanks,
Alfredo
 
A

Alex Papadimoulis

Alfredo,

I often find myself using javascript arrays to accomplish this. You can
create the arrays manually or try the Page.RegisterArrayDecleration method.
Multi dimensional arrays really aren't an option in Javascript, but, nested
arrays are. Here's an example from classic ASP of transfering an array ... I
like filling arrays like this because you can access the items like:
arrApprovers[ ApproverID ].FullName ....

var arrApprovers = new Array();
<%if IsArray(arrApprovers) then %>
<% for counter = 0 to UBound(arrApprovers,2) %>
arrApprovers['<%=arrApprovers(0,counter)%>'] = new Array();
arrApprovers['<%=arrApprovers(0,counter)%>']['FullName'] =
'<%=JSClean(arrApprovers(1,counter))%>';
arrApprovers['<%=arrApprovers(0,counter)%>']['Title'] =
'<%=JSClean(arrApprovers(3,counter))%>';
<% next %>
<% end if %>

Alex Papadimoulis
 

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,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top