Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 16th, 2005, 04:49 AM
Authorized User
 
Join Date: Apr 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default using dictionary object

Hi All,
i created dictionary object in asp code and i want to use it in java script in controls envent handler for client site
pls suggest me how to do this


 
Old June 17th, 2005, 01:08 PM
Registered User
 
Join Date: Apr 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have passinfomation between languages numerous time and methods can you be more specific. I dont want waist time, but I am confident i could show you an example. Do you need the entire object? I have transfered a dataset into an array and imported. it as follows:
    rs.open SP_Var, Conn
    If RS.EOF=false then
      MyArray=RS.GetRows
      MaxCols=ubound(MyArray,1)
      MaxRows=ubound(MyArray,2)
    End If


arrayname= "NewArray"
Response.Write("<SCR"&"IPT LANGUAGE = 'VBSCRIPT' >"&chr(13))
response.write ("Dim NewArray(" & Maxcols & "," & MaxRows & ")"&chr(13))

for vb2jsi=0 to Maxcols
  for vb2jsj=0 to MaxRows
    vb2jsstr = "MyArray("&vb2jsi&","&vb2jsj&")"
%>
    <%=ArrayName%>(<%=vb2jsi%>,<%=vb2jsj%>) = "<%=trim(eval(vb2jsstr))%>"
<%
  Next
Next
Response.Write("</SCR"&"IPT>")

You can Probably use a for and Next loop to iterate through your dictionary and put the data int an array. Anyway i hope this helps



 
Old June 20th, 2005, 01:23 PM
Authorized User
 
Join Date: Apr 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi casselj
thanks for ur response
i used ur way to get the array in client site script
that was working but still i got some problem
1. my system is getting too slow while processing the script
2 . becouse i am writing recordset values in the array and then on change of select control i want to compare the select value with the element in the array
but this comparison is not going to happen
so i am unable to solve the problem
i am sending u the part of code which i used

code is below-:

 set rsvehicle=server.CreateObject("Adodb.recordset")
    rsvehicle.cursorlocation=3
    rsvehicle.ActiveConnection =con
sqlveh="select a.vehicleno,b.name,b.contact from vehicle_master a,driver_master b where a.facilityid="& facid & " and a.vendorid='"& vid & "' and a.driver_id=b.driver_id"

    'getting vhicleno with drivername and no
    set rsvehicle=con.execute(sqlveh)

    If rsvehicle.EOF=false then
       MyArray1=rsvehicle.GetRows()
       end if
               MaxCols1=ubound(MyArray1,1)
           MaxRows1=ubound(MyArray1,2)
    arrayname1= "NewArray1"


Response.Write("<SCR"&"IPT LANGUAGE = 'VBSCRIPT' >" &chr(13))
response.write ("Dim NewArray1(" & Maxcols1 & "," & MaxRows1 & ")"&chr(13))
for vb2jsi=0 to Maxcols1
  for vb2jsj=0 to MaxRows1
   vb2jsstr = "MyArray1("&vb2jsi&","&vb2jsj&")"
    %>
     <%=ArrayName1%>(<%=vb2jsi%>,<%=vb2jsj%>) = "<%=trim(eval(vb2jsstr))%>"

     <%

  Next
Next
Response.write("sub vehicleonchange(i)" & chr(13))
'getting the index of current select named vehicle in i
Response.Write("dim se" & chr(13))
Response.Write ("dim dname" & chr(13))
Response.Write ("dim dphone" & chr(13))
Response.Write (chr(13))
Response.Write ("se=document.all" & "(""vehicle"")(i).value")
' getting the value of current vehicle select
Response.Write (chr(13))
Response.Write("msgbox se"& chr(13)) ' for checking
 Response.write("for vb2jsj=0 to ubound(NewArray1)"& chr(13))
 Response.write("msgbox cstr(NewArray1(0,vb2jsj))" & chr(13)) ' for checking
Response.Write("msgbox cstr(se)"& chr(13)) ' for checking
 Response.write("if cstr(NewArray1(0,vb2jsj))=cstr(se) then" & chr(13))
 Response.Write("dname=NewArray1(1,vb2jsj)")
 Response.Write (chr(13))
 Response.Write("dphone=NewArray1(2,vb2jsj)")
 Response.Write (chr(13))
 Response.Write("end if" & chr(13))
Response.Write("next" & chr(13))
Response.write("msgbox dname" & chr(13))
Response.Write("msgbox dphone"& chr(13))
Response.write("end sub" & chr(13))
Response.Write("</SCR"&"IPT>")


















 
Old June 21st, 2005, 07:16 AM
Registered User
 
Join Date: Apr 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Im not sure how you meant the comparison should happen. I assume you mean that when a user selects from the dropdown you you want to iterate through the set to display the array? is this correct?
Perhaps the rest of the code will help me.

 
Old June 21st, 2005, 02:53 PM
Authorized User
 
Join Date: Apr 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx for ur response dear ,

what u assumed , is right , my objective is to maintain the related information(as driver name and his phone ) in an array ,becoz i am adding all vehicle number in select.so i want when a user click on vehicle id then its drivername and phone should be displayed.

so i am comparing selected value with the array elements.








Similar Threads
Thread Thread Starter Forum Replies Last Post
dictionary object with session scope lcsgeek Classic ASP Basics 1 May 3rd, 2005 09:48 AM
Exception Error using Dictionary Object andersoni Classic ASP Basics 2 July 24th, 2004 12:58 PM
sessions and the dictionary object lcsgeek Classic ASP Professional 1 January 27th, 2004 06:11 AM
PHP and ASP 'Dictionary Object' HammR Beginning PHP 5 December 6th, 2003 11:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.