I have this google auto complete inside update panel after refresh it does not work
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtarea" runat="server" TextMode="SingleLine"></asp:TextBox>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false&key=AIzaStUJlDy_7DHb2--4"></script>
<script type="text/javascript">
google.maps.event.addDomListener(window, 'load', function SetAutoComplete () {
var options = { types: ['(cities)'] };
var places = new google.maps.places.Autocomplete(document.getElementById('<%=txtarea.ClientID%>'));
google.maps.event.addListener(places, 'place_changed', function () {
var place = places.getPlace();
var address = place.formatted_address;
var latitude = place.geometry.location.lat();
var longitude = place.geometry.location.lng();
var mesg = "Address: " + address;
mesg += "\nLatitude: " + latitude;
mesg += "\nLongitude: " + longitude;
//alert(mesg);
});
});
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
SetAutoComplete();
}
});
};
</script>
<asp:Button ID="Button1" runat="server" Text="Submit Your Request" ValidationGroup="jobpost" OnClientClick="if (!Page_ClientValidate('jobpost')){ return false; } this.disabled = true; this.value = 'Processing...';" UseSubmitBehavior="False" />
</ContentTemplate>
</asp:UpdatePanel>
please advice