title: Asp.Net and Shadowbox
body: <p>Trying to pop up an IFrame Shadowbox with Jquery from an asp:gridview datarow. I can't get the proper quotes into the string:</p>
  
  <pre><code>&lt;asp:ImageButton ID="btnEdit" runat="server"
      OnClientClick='&lt;%# "javascript:popAccount(\'"+ 
      Eval("id", "Popup.aspx?id={0}")+"\');" %&gt;' /&gt;
  </code></pre>
  
  <p>Parser Error Message: The server tag is not well formed.</p>
  
  <p>Without the escaped single quotes (cannot work, but parses properly):</p>
  
  <pre><code>&lt;asp:ImageButton ID="btnEdit" runat="server"
      OnClientClick='&lt;%# "javascript:popAccount("+ 
      Eval("id", "Popup.aspx?id={0}")+");" %&gt;' /&gt;
  </code></pre>
  
  <p>Client-side HTML, as expected:</p>
  
  <pre><code>onclick="javascript:popAccount(Popup.aspx?id=3ce3b19c-1899-4e1c-b3ce-55e5c02f1);"
  </code></pre>
  
  <p>How do I get quotes into the Javascript?</p>
  
  <p>Edit: added solution. This not very generic, since the databound types must be known in order to access the id property. The key (as defined in the GrodView's DataKeyNames parameter) does not seem to be exposed in the event argument. But it works.</p>
  
  <pre><code>    protected void editGrid_RowDataBound(object sender, GridViewRowEventArgs e)
      {
          // do not look at header or footer
          if (e.Row.RowType == DataControlRowType.DataRow)
          {
              ImageButton btn = e.Row.FindControl("btnPopup") as ImageButton;
              if (btn != null)
              {
                  btn.OnClientClick = 
                  "javascript:popAccount('EditAccountPopup.aspx?"+
                  Constants.acctidParam+"="+
                  ((tb_account)(e.Row.DataItem)).id.ToString()+"');";
              }
          }
  </code></pre>