I have a Server side variable by the following code
Dim mgps As New Text.StringBuilder
Public ReadOnly Property GPS() As String
Get
Return mgps.ToString
End Get
End Property
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim con As New OleDbConnection
con = New OleDbConnection("Data Source=sml; User ID=sml; Password=sml; provider=OraOLEDB.Oracle")
con.Open()
Dim cmd As OleDbCommand = New OleDbCommand("Select STA_NAME, GPS_ONE from GPS", con)
Dim ds As New DataSet
Dim I As Long
Dim da As New OleDbDataAdapter(cmd)
da.Fill(ds, "GPS")
mgps.AppendLine("[")
For I = 0 To ds.Tables("GPS").Rows.Count - 1
mgps.AppendLine(ds.Tables("GPS").Rows(I).Item("GPS_ONE") & ",")
Next I
mgps.AppendLine("];")
End Sub
The Variable is Global named GPS
Now I am trying to access it in client side JS Array
JS Array is below
var store_locations = new Array();
store_locations = [
new google.maps.LatLng(31.204549793299,72.264183974237),
new google.maps.LatLng(31.23004996385,72.282225091978),
new google.maps.LatLng(31.148218,72.224542),
new google.maps.LatLng(31.2330555556,72.3330555556)
];
Now I want to use GPS varible values instead of custome values in store_locations.
How can it be done anyone please help me.
Here is my loop where I want to access the array values.
for(i=0; i<store_locations .length-1; i++)
{
var image = 'ico/no.png';
markers[i] = new google.maps.Marker(
{
position: store_locations [i],
map: map,
draggable:true,
icon:image,
title: (i+1) + GPS
});
}
I have access the GPS variable as below
var GPS = <%=GPS %>
and replace the store_locations with GPS but my map become empty.
Please tell me what exactly i am missing to do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…