title: ImageButton OnMouseOver Call C# function
body: <p>I have a problem with an Image Button and its <code>onmouseover</code> action.</p>
  
  <p>In my ASPX file I have something like:</p>
  
  <pre class="lang-js prettyprint-override"><code>&lt;script type="text/javascript"&gt;
      function dosth() {
          document.getElementById("btnload").click();
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>...</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;asp:Panel ID="pnUp" Height="200px" runat="server"&gt;&lt;/asp:Panel&gt;
  </code></pre>
  
  <p>...</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;asp:Button ID="btnload" runat="server" OnClick="btnload_Click"
      Visible="false" /&gt;
  </code></pre>
  
  <p>...</p>
  
  <p>And in my ASPX .cs file something like:</p>
  
  <pre class="lang-cs prettyprint-override"><code>ImageButton btnImg = new ImageButton();
  
  protected void Page_Load(object sender, EventArgs e)
  {
      btnImg.ID = "btnImg";
      btnImg.ImageUrl = "images/imgbutton.png";
      btnImg.CssClass = rblSize.SelectedValue.ToString();
      btnImg.Attributes.Add("OnMouseOver", "dosth();");
      pnUp.Controls.Add(btnImg);
  }
  
  protected void btnload_Click(object sender, EventArgs e)
  {
      // stuff to do
  }
  </code></pre>
  
  <p>But this doesn't work. </p>
  
  <p>Do you know how to run C# function in <code>onmouseover</code> action. The JavaScript function <code>dosth()</code> is executing, but still it doesn't run the click function.</p>