Advertisement

05.13.2008 at 12:21PM PDT, ID: 23399093 | Points: 500
[x]
Attachment Details

Passing value from javascript to ASP

Asked by flfmmqp in Active Server Pages (ASP), JavaScript

How do I pass the value of document.getElementById("ddlDiv").value to my SQL statement                         objRS.Open "SELECT Atlas_IR_File_Listing.Division_N, Atlas_IR_File_Listing.StateName, Atlas_IR_File_Listing.Longitude, Atlas_IR_File_Listing.Latitude, Atlas_IR_File_Listing.Market_Name, Atlas_IR_File_Listing.PDF_Location, Atlas_IR_File_Listing.NumTxt FROM Atlas_IR_File_Listing Where Atlas_IR_File_Listing.Division_N ='" & strDiv & "';", "dsn=AR_Atlas"

What I am trying to do is update the results of my google map depending on what is selected using other combo boxes.  

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
function PopulateMarkets2(strDiv)
{
 
 //alert(strDiv)
 alert(document.getElementById("ddlDiv").value)
 
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl()) ;
        map.addControl(new GScaleControl()) ;
 
	var ovcontrol = new GOverviewMapControl(new GSize(165,165));
	map.addControl(ovcontrol);
 
        var center = new GLatLng(39.10341, -84.51134);
        map.setCenter(center, 5);
        geocoder = new GClientGeocoder();
        var marker = new GMarker(center, {draggable: true});  
        map.addOverlay(marker);
 
        
//----------  Load Stores ------------///
	//CLIENT-SIDE JAVASCRIPT ARRAY TO HOLD COPY OF DB DATA
	var data = new Array();
	<%
		//SERVER-SIDE CODE THAT GENERATES DATA FOR JAVASCRIPT ARRAY  
                Set objRS = Server.CreateObject("ADODB.Recordset")
				objRS.Open "SELECT Atlas_IR_File_Listing.Division_N, Atlas_IR_File_Listing.StateName, Atlas_IR_File_Listing.Longitude, Atlas_IR_File_Listing.Latitude, Atlas_IR_File_Listing.Market_Name, Atlas_IR_File_Listing.PDF_Location, Atlas_IR_File_Listing.NumTxt FROM Atlas_IR_File_Listing Where Atlas_IR_File_Listing.Division_N ='" & strDiv & "';", "dsn=AR_Atlas"
 
                //Loop through the recordset adding each Division to the combo box
                Do While Not objRS.EOF
			 	Response.Write("data[data.length] ={'Division_N':'" & objRS.Fields("Division_N").Value & "','StateName':'" & objRS.Fields("StateName").Value & "','LATITUDE':'" & objRS.Fields("Latitude").Value & "','LONGITUDE':'" & objRS.Fields("Longitude").Value & "'};")
                    objRS.MoveNext
                Loop
                'Close and dereference database objects
                objRS.Close
                Set objRS = Nothing              
                Set objConnection = Nothing
     %> 
      	for( var i=0; i<data.length; ++i)
	        {
              var point = new GLatLng(data[i].LATITUDE, data[i].LONGITUDE);
              // This works var marker = createMarker(point,'<div style="width:240px">StateName:' + data[i].StateName + '<br><a href=http:\\"' + data[i].PDF + '">Click Link to get Market PDF Map</a></div>');
              var html1 = '<div style="width:240px">Division:' + data[i].Division_N + '<br></div>'
              var marker = createMarker2(point,html1);
              map.addOverlay(marker);}
}
 
Loading Advertisement...
 
[+][-]05.13.2008 at 12:34PM PDT, ID: 21558522

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 12:38PM PDT, ID: 21558556

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 12:57PM PDT, ID: 21558706

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628