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

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.
Posted
Updated 14-Sep-12 23:48pm
v2

Hi,

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.

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


Thanks,
Viprat
 
Share this answer
 
Comments
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.

cheers
 
Share this answer
 

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