Why sometime control does not go to the event when it is click?
<p>I have used the following code. This code works sometime but sometime not works. Please explain the resion and modify the code.</p>

<p>.aspx page:</p>

<pre><code>&lt;td valign="top" align="left" width="10px" runat="server" id="tdNoteRightBar"&gt;
    &lt;asp:HiddenField runat="server" ID="hidNoteId" Value='&lt;%# Eval("PK_ID").ToString() %&gt;' /&gt;
    &lt;asp:ImageButton ID="ibtnAddToPin" runat="server" ImageUrl="~/Images/pin_addto.png"
      OnClick="ibtnAddToPin_Click" ToolTip="Pin this note to stay on top." Style="padding-right: 1px;" /&gt;
    &lt;asp:ImageButton ID="ibtnPinMarkedRemovePin" runat="server" ImageUrl="~/Images/pin_marked.png"
      Visible="false" OnClick="ibtnPinMarkedRemovePin_Click" Style="padding-top: 2px;" /&gt;
&lt;/td&gt;
</code></pre>

<p>.cs page</p>

<pre><code>    protected void ibtnAddToPin_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        try
        {
            ListViewDataItem dataItem = (ListViewDataItem)(((ImageButton)sender).Parent.Parent);
            int noteId = Convert.ToInt32(((HiddenField)dataItem.FindControl("hidNoteId")).Value);

            Notes.PinANote(noteId);
        }
        catch (Exception ex)
        {
            ExceptionLogger.LogException(ex);

            lblError.ForeColor = System.Drawing.Color.Red;
            lblError.Text = "Error occurred while pinning the note.";
        }
    }

    protected void ibtnPinMarkedRemovePin_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    {
        try
        {
            ListViewDataItem dataItem = (ListViewDataItem)(((ImageButton)sender).Parent.Parent);
            int noteId = Convert.ToInt32(((HiddenField)dataItem.FindControl("hidNoteId")).Value);

            Notes.UnPinANote(noteId);
        }
        catch (Exception ex)
        {
            ExceptionLogger.LogException(ex);

            lblError.ForeColor = System.Drawing.Color.Red;
            lblError.Text = "Error occurred while un pinning the note.";
        }
    }
</code></pre>
