Hello All,
I am developing a web application in which i have RadGrid. In the RadGrid Edit button, I am calling a Javascript function which will get the geocodes and writes in to the hidden fields. Now the problem is, If I put the alert message in that function, I can see the geocodes properly. If i remove the alert message, the hidden fields are blank.
I guess the probelm is, I am reading those hidden field values from code behind before the page loads completly.
Here is my javascript
function initiate_geolocation() {
navigator.geolocation.getCurrentPosition(handle_geolocation_query);
alert('delay to get the geocodes');
return false;
}
function handle_geolocation_query(position){
enableHighAccuracy: true
var lat = '<%=hidLat.ClientID %>';
var lon = '<%= hidLong.ClientID %>';
document.getElementById(lat).value = position.coords.latitude;
document.getElementById(lon).value = position.coords.longitude;
}
And in the code behind, in the item data bound event
i added the attributes for the edit button and called the javascript function
Dim editButton As ImageButton = DirectCast(item.FindControl("EditButton"), ImageButton)
editButton.Attributes.Add("OnClick", "initiate_geolocation();")
Im trying to access those hidden fields in the update command event of the Radgrid
Is there something to do to let the form load completly and then read those hidden fields? How do I get out of this problem?
Appreciate the Help!
Thanks