title: ASP.NET ImageButton onclick javascript not firing
body: <p>I have a bunch of very similar pages on my site, and on many of them, I have ImageButtons that remove or delete some sort of grid/tree entry. For all of those, I want to tie a javascript that essentially pops up a "Do you really want to delete x" dialog window.</p>
  
  <p>It's working fine on almost every page, but on this particular one, the script never fires. When inspecting the button, I see the onclick event corretly listed. But upon clicking the button, I get the following console error on the client:</p>
  
  <pre><code>ReferenceError: removeButtonConfirmation is not defined
  </code></pre>
  
  <p>And nothing else happens.</p>
  
  <p>The button in the .ascx file:</p>
  
  <pre><code>&lt;telerik:GridTemplateColumn UniqueName="DeleteColumn"&gt;
      &lt;ItemTemplate&gt;
             &lt;asp:ImageButton runat="server" ID="DeleteButton" CommandName="Delete" /&gt;
      &lt;/ItemTemplate&gt;
  &lt;/telerik:GridTemplateColumn&gt;
  </code></pre>
  
  <p>The code behind:</p>
  
  <pre><code>var deleteButton = item["DeleteColumn"].FindControl("DeleteButton") as ImageButton;
  deleteButton.ImageUrl = UrlHelper.SharedImage("delete2.png");
  deleteButton.ToolTip = SiteTextResources.Administration_ShippingManager_Remove;
  var onclickValue = String.Format("return removeButtonConfirmation('{0}');", "Are you sure you want to delete this?");
   deleteButton.Attributes.Add("onclick", onclickValue);
  </code></pre>
  
  <p>The js:</p>
  
  <pre><code>function removeButtonConfirmation(message) {
      var result = window.confirm(message);
      if (result)
          return true;
      else
          return false;
  }
  </code></pre>