Need to click button twice to get search results
<p>I'm just starting with ASP.NET in college, and I'm stuck on this one:</p>

<pre><code>&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;            
        &lt;ContentTemplate&gt;
&lt;asp:Button ID="searchGmapButton" runat="server" Text="Search" OnClientClick="SetMap();" /&gt;
</code></pre>

<p>when I click this button it calls JavaScript, that gets value from textbox and uses google maps api to show map and return longitude and latitude. Then I'm putting those into two  hidden textboxes, </p>

<pre><code>$("#MainContent_latBox").val(Marker.getPosition().lat().toString());
$("#MainContent_lngBox").val(Marker.getPosition().lng().toString());
</code></pre>

<p>so I can use them in aspx.cs code, that displays closest locations using db search. I'm using for this OnTextChanged="lngBox_TextChanged" on one of those hidden textboxes. Problem is that when I click searchGmapButton it displays map location, and lngBox_TextChanged is working on second click. 
I tried to use OnClientClick to run JavaScript and OnClick to run asp code, </p>

<pre><code>&lt;asp:Button ID="searchGmapButton" runat="server" Text="Search" OnClientClick="SetMap();" onclick="Button1_Click"/&gt;&lt;br /&gt;
</code></pre>

<p>but then OnClick code is not working at all. Same happens with first example when I move searchGmapButton outside AJAX UpdatePanel.
Did I missed something silly, or did I got it completely wrong?</p>
