HiddenField does not send value to client-side javascript code during button click

I have a Button which calls other buttons:

protected void Button2_Click(object sender, EventArgs e)
{
  Button3_Click(this, null);
  Button4_Click(this, null);
}

Button3 sets double values in HiddenField:

protected void Button3_Click(object sender, EventArgs e)
{
  for (int i = 0; i < GridView1.Rows.Count; i++)
  {
    if (Convert.ToDouble(GridView1.Rows[i].Cells[1].Text) > 3)
    {
      double count1 +=1;
    }

    if (Convert.ToDouble(GridView1.Rows[i].Cells[2].Text) > 0)
    {
      double count2 += 1;
    }

    HiddenField_count1.Value = count.ToString(); 
    HiddenField_count2.Value = count2.ToString(); 
  }
}

Then take values in javascript:

<div id="divRatio" >
  <h3 id="ratio_N">0</h3>
  <p>&nbsp;</p>
</div>
function calc()
{
  var count_1 = document.getElementById('<%=HiddenField_count1.ClientID%>').value;
  var count_2 = document.getElementById('<%=HiddenField_count2.ClientID%>').value;
  var count_ratio = count_2 / count_1;
  document.getElementById("ratio_N").innerHTML = String('ratio:' + count_ratio );
}

Then call calc() in Button2:

<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional"  runat="server" >
  <Triggers> 
    <asp:PostBackTrigger ControlID="Button2"  />
  </Triggers>
  <ContentTemplate>
    <asp:Button ID="Button2" runat="server" CssClass="buttonR"  OnClick="Button2_Click" Font-Bold="True" Font-Overline="False" Text="calc"  OnClientClick ="calc();"  />   

The problem is that HiddenField only gets values after clicking Button2 second time. I made a research on the internet but didn`t found a good solution