Click here to Skip to main content
15,392,261 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I getting values from database like latitude and longitude to dataset. i order to display them on google map.i want to bring them to .aspx page. how can i do it.

Thanks in advance.
Updated 14-Sep-12 23:48pm


You can take 2 protected variable. And save latitude and longitude into that variable. You can get that value on the client side in java script.

var xyz = '<%= variable %>';

07405 15-Sep-12 5:50am
i getting that into dataset. i want to loop it in javascript
In google map, you need to set the values(lat,long) from dataset to be available in your client side (javascript).

You have already done the populate part and get the values in dataset.

To get the values in client side,
you can create two hidden fields make it runat="server"
<input type="hidden" id="hdnLat" runat="server" />
<input type="hidden" id="hdnLong" runat="server" />

//Create a variable that can access the server side control
var objLat = docuent.getElementById("<%= hdnLat.ClientID %>");
var objLat = docuent.getElementById("<%= hdnLong.ClientID %>");

Now in code behind page load, use the dataset to get the lat and Long value and assign it in the above two variable.

hdnLat.Value = {value from dataset};
hdnLong.Value = {value from dataset};

In your google map creation routine in javascript, you can now use the value
objLat.value and objLong.value.

This should work.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900