wilberforce2
IS-IT--Management
Hello
I am new to ASP.net 2.0 and I am having some problems creating a distance related search in a directory.
I am using the following code to get Latitude and longitude data from google maps from a postcode a user types in to perform a search. The problem I am having is that to use the showAddress function I must call it with return false but this prevents the form posting and the search being imitated. Any ideas in how I can solve this issue. I have looked everywhere on the web and cannot find any examples. I am using Visual Web Studio Express Edition. The database already has the Latitude and longitude details for each entry. I can post the full code if it’s required.
Thanks
I am new to ASP.net 2.0 and I am having some problems creating a distance related search in a directory.
I am using the following code to get Latitude and longitude data from google maps from a postcode a user types in to perform a search. The problem I am having is that to use the showAddress function I must call it with return false but this prevents the form posting and the search being imitated. Any ideas in how I can solve this issue. I have looked everywhere on the web and cannot find any examples. I am using Visual Web Studio Express Edition. The database already has the Latitude and longitude details for each entry. I can post the full code if it’s required.
Thanks
Code:
<script type="text/javascript">
var map = null;
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
alert("GeoCode")
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
alert(point.y)
//document.getElementById("DetailsView1_LatTextbox").value = point.y
//document.getElementById("DetailsView1_LonTextbox").value = point.x
}
}
);
}
}
</script>
OnClientClick="showAddress(document.getElementById('TextBox1').value); return false" />