title: Using JavaScript to do ASP.NET postback (clicking LinkButton) - postback occurs but not Click event
body: <p>I am using some script to cause a postback. Here is the context:</p>
  
  <ul>
  <li>User clicks link to perform a function that needs to know their current location</li>
  <li>Script gets current location from browser (using navigator.geolocation.getCurrentPosition)</li>
  <li>When it has the location (the above call is asynchronous - you have to wait for the user to consent to share their location) I want the script to post the location back to the server. I do this by simulating a postback from a hidden link button.</li>
  </ul>
  
  <p>Here is the relevant code:</p>
  
  <pre><code>function submitLocation_Inline(position) {
  var latitude = position.coords.latitude;
  var longitude = position.coords.longitude;
  document.getElementById("ctr11837_Locator_hLat").value = latitude;
  document.getElementById("ctr11837_Locator_hLng").value = longitude;
  var prm = Sys.WebForms.PageRequestManager.getInstance();
  prm._doPostBack('ctr11837_Locator_btnSubmitLocation', 'inline');
  } 
  
  &lt;a href="javascript:__doPostBack('ctr11837$Locator$btnSubmitLocation','')" id="ctr11837_Locator_btnSubmitLocation"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>In the code behind I have a handler for the click event on the hidden linkbutton (btnSubmitLocation_Click). However this is never called. The postback does happen fine, but to process it I have to examine the Request["_<em>EVENTTARGET"] and Request["</em>_EVENTARGUMENT"] during Page_Load to verify it is the postback I want.</p>
  
  <p>How would I adapt my code to cause the btnSubmitLocation_Click to be called?</p>
  
  <p>PS - not sure if this is relevant: the hidden linkbutton is inside an UpdatePanel.</p>