title: Pass JSON string into clientside onclick event from EVAL
body: <p>On the UI, I've got this:</p>
  
  <p><a href="https://i.stack.imgur.com/h43LU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h43LU.png" alt="enter image description here"></a></p>
  
  <p>It's a div inside a Gridview with a JSON string inside of it, and next to it is an icon that I want to use as a "copy to clipboard".  I already have the CopyToClipBoard javascript method, and it works fine.  What I'm having trouble with is getting the json string inside of the onclick method.  Some things I've tried:</p>
  
  <pre><code>onclick='copyToClipboard("&lt;%# Eval("LogText")%&gt;")'
  onclick="copyToClipboard('&lt;%# Eval("LogText")%&gt;')"
  </code></pre>
  
  <p>And all of the suggestions on this thread:</p>
  
  <p><a href="https://stackoverflow.com/questions/249926/passing-eval-from-aspx-to-javascript-function-as-parameter">Passing Eval from ASPX to Javascript function as Parameter</a></p>
  
  <p>Here's the full JSON string:</p>
  
  <pre><code>{
    "DoorId": "11574544",
    "DoorName": "out - door controller",
    "CardNumber": "65529",
    "FacilityCode": null,
    "EventID": "570924d6-94b4-45b4-aa2d-9ab4075dc668",
    "EventTimestamp": "2017-11-10 11:10:10.301",
    "Name": "Norman Bates",
    "AccessControlUserId": "15531926",
    "OrganizationSys": 1012,
    "AccessGranted": true,
    "FirstName": "Norman",
    "LastName": "Bates",
    "Email": null,
    "UserName": "normanbates",
    "Password": "Password",
    "Pin": null,
    "CreateUserIfNotExists": false,
    "CreateDoorIfNotExists": true,
    "DoorStatusSys": 476,
    "DoorLocationSys": 103979,
    "AccessIntegrationSys": 100001
  }
  </code></pre>
  
  <p>The problem is that all of the quotes seem to be messing things up. At least I think. For example, with this:</p>
  
  <pre><code>onclick='copyToClipboard("&lt;%# Eval("LogText")%&gt;")'
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>&lt;img src="..." onclick="copyToClipboard("{"DoorId":"11574544","DoorName":"out - door controller","CardNumber":"65529","FacilityCode":null,"EventID":"570924d6-94b4-45b4-aa2d-9ab4075dc668","EventTimestamp":"2017-11-10 11:10:10.301","Name":"Norman Bates","AccessControlUserId":"15531926","OrganizationSys":1012,"AccessGranted":true,"FirstName":"Norman","LastName":"Bates","Email":null,"UserName":"normanbates","Password":"Password","Pin":null,"CreateUserIfNotExists":false,"CreateDoorIfNotExists":true,"DoorStatusSys":476,"DoorLocationSys":103979,"AccessIntegrationSys":100001}")"&gt;
  </code></pre>
  
  <p>When I click on the icon, I get this in the console:</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: missing ) after argument list</p>
  </blockquote>
  
  <p>Not sure how to get this right.</p>