title: Triple Quotes? How do I delimit a databound Javascript string parameter in ASP.NET?
body: <p>How do I delimit a Javascript data-bound string parameter in an anchor <code>OnClick</code> event?</p>
  <ul>
  <li>I have an anchor tag in an ASP.NET Repeater control.</li>
  <li>The <code>OnClick</code> event of the anchor contains a call to a Javascript function.</li>
  <li>The Javascript function takes a string for its input parameter.</li>
  <li>The string parameter is populated with a data-bound value from the Repeater.</li>
  </ul>
  <p>I need the &quot;double quotes&quot; for the <code>Container.DataItem</code>.<br />
  I need the 'single quotes' for the <code>OnClick</code>.</p>
  <p>And I still need <em>one more delimiter</em> (triple quotes?) for the input string parameter of the Javascript function call.</p>
  <p>Since I can't use 'single quotes' again, how do I ensure the Javascript function knows the input parameter is a string and not an integer?</p>
  <p>Without the extra quotes around the input string parameter, the Javascript function thinks I'm passing in an integer.</p>
  <p>The anchor:</p>
  <pre><code>&lt;a id=&quot;aShowHide&quot; onclick='ToggleDisplay(&lt;%# DataBinder.Eval(Container.DataItem, &quot;JobCode&quot;) %&gt;);' &gt;Show/Hide&lt;/a&gt;    
  </code></pre>
  <p>And there is my Javascript:</p>
  <pre><code>&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
  /* Shows/Hides the Jobs Div */
  function ToggleDisplay(jobCode)
  {
      /* Each div has its ID set dynamically ('d' plus the JobCode) */
      var elem = document.getElementById('d' + jobCode);
  
      if (elem) 
      {
          if (elem.style.display != 'block') 
          {
              elem.style.display = 'block';
              elem.style.visibility = 'visible';
          } 
          else
          {
              elem.style.display = 'none';
              elem.style.visibility = 'hidden';
          }
      }
  }
  &lt;/script&gt;
  </code></pre>