title: ASP.net project image button redirects to another page only on double click
body: <p>ASP code</p>
  
  <pre><code> &lt;asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/product1.jpg" OnClick="ImageButton1_Click" /&gt;
  </code></pre>
  
  <p>Event code</p>
  
  <pre><code> public void ImageButton1_Click(object sender, ImageClickEventArgs e)
      {
  
          product product = new product { };
          product.Id = Convert.ToInt32(3);
          ImageButton1.PostBackUrl = "~/Pages/Product.aspx?id=" + product.Id;
      }
  </code></pre>
  
  <p>I want to redirect to a page named product when an image button is clicked but the product page will only display when a product id is passed. Productid is coming from the product table, for example product id is "3" is passing a <code>product.Id</code>.</p>
  
  <p>This is working only when you click on the image button a 2nd time.</p>
  
  <p>When you click on the button once it will refresh the page then you have to click it again for it to do the redirect to the product page. Does anyone know why?</p>