Sometimes imagebutton click event not fired
<p>I have a method that add's an onclick event too an imagebutton.
But sometimes you have to press the button multiple times before the "pop-up" window opens.
Any idea why this happens?</p>

<p>this is my code were I add the event to my imagebutton:</p>

<pre><code>private void AddProjectDetails()
    {
        ImageButton imgBtn;
        HiddenField hfld;
        String ProjectNumber;
        for (int i = 0; i &lt; GridViewProperties.Rows.Count; i++)
        {
            hfld = GridViewProperties.Rows[i].FindControl("HiddenProjId") as HiddenField;
            imgBtn = GridViewProperties.Rows[i].FindControl("ibtnShowExtra") as ImageButton;
            ProjectNumber = hfld.Value;
            imgBtn.Attributes.Add("onclick", "window.open('ProjectDetails.aspx?ProjectNumber=" + Server.UrlEncode(ProjectNumber) + "','Graph','height=590,width=600,left=50,top=50,scrollbars=yes'); return true;");
        }
    }
</code></pre>
