title: When I use window.location.href ,then my another function not calling .Following is my javascript code
body: <p>I am using Following code..</p>
  
  <ol>
  <li>When I click on the link, the javascript <code>Hello()</code> function is invoked</li>
  <li>I want to use <code>window.location.href</code></li>
  <li>But when I use this the following  <code>__doPostBack('Button2_Click')</code>, it does not work.</li>
  <li><p>But when remove <code>window.location.href</code> from the following code then <code>__doPostBack('Button2_Click')</code> does work.</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
  
      function Hello(clicked_id) {
          var abc = "http://localhost:2621/OrgChart.aspx?id" + clicked_id;
          window.location.href = abc;
          __doPostBack('Button2_Click');
  
          return false;
      }
  
  &lt;/script&gt;
  
  &lt;a id="A1" href="javascript:Hello();"&gt;LINK&lt;/a&gt;
  </code></pre></li>
  </ol>
  
  <p>This is my code behind code...</p>
  
  <pre><code>  public partial class WebForm17 : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          ClientScript.GetPostBackEventReference(this, string.Empty);//This is important to make the "__doPostBack()" method, works properly 
  
          if (Request.Form["__EVENTTARGET"] == "Button2_Click")
          {
              //call the method 
              Button2_Click(this, new EventArgs());
          } 
  
      }
  
      protected void Button2_Click(object sender, EventArgs e)
      {
  
          Label1.Text = "Method called!!!";
          EmpInfo emp = new EmpInfo();
          DA_EmpInfo da_emp = new DA_EmpInfo();
          List&lt;EmpInfo&gt; lei = da_emp.GetAllEmployeeInfoByEmpId("MJ-IB-1");
          DetailsView1.DataSource = lei;
          DetailsView1.DataBind();
      }
  }
  </code></pre>