title: How to pass multiple parameters to Eval()?
body: <p>i have a bit of aspx code that uses Eval to generate a call to a javascript function:</p>
  
  <p><strong>ASP.NET (wrapped for readability):</strong></p>
  
  <pre><code>&lt;asp:LinkButton runat="server"
     OnClientClick='&lt;%# Eval(
           "NodeGUID", 
           "return DoStuff(this, \"{0}\");") %&gt;'
     Text="Do stuff" /&gt;
  </code></pre>
  
  <p>this generates javascript similar to:</p>
  
  <p><strong>Javascript (wrapped for readability):</strong></p>
  
  <pre><code>return DoStuff(this,
        "3F2504E0-4F89-11D3-9A0C-0305E82C3301"
     );
  </code></pre>
  
  <p><strong>Note:</strong> <em>i've converted the generated <strong>&amp;quot;</strong> entities references into quotes for readability.</em></p>
  
  <p>i now need to add a 3nd parameter to the javascript function call, a caption:</p>
  
  <p><strong>Javascript (wrapped for readability)</strong></p>
  
  <pre><code>return DoStuff(this,
        "3F2504E0-4F89-11D3-9A0C-0305E82C3301",
        "AllisonAngel.jpg"
     );
  </code></pre>
  
  <p><strong>Note:</strong> <em>i've converted the generated <strong>&amp;quot;</strong> entities references into quotes for readability.</em></p>
  
  <hr>
  
  <p>There already exists a function in the code-behind file that is used to return the caption for an item:</p>
  
  <p><strong>C# (code omitted for readability):</strong></p>
  
  <pre><code>protected string GetItemText(MySomething item)
  {
     ...
  }
  </code></pre>
  
  <p>i know that the above function can be called from the aspx file using a syntax similar to:</p>
  
  <p><strong>ASP.NET (wrapped, code omitted, for readability):</strong></p>
  
  <pre><code>&lt;asp:LinkButton ... runat="server"
     Text="&lt;%# GetItemText((MySomething)Container.DataItem) %&gt;" 
     ... /&gt;
  </code></pre>
  
  <p>So now i want to use this function to include the 3rd parameter to the javascript function. </p>
  
  <p>Starting from:</p>
  
  <pre><code>&lt;asp:LinkButton runat="server"
     OnClientClick='&lt;%# Eval(
           "NodeGUID",
           "return DoStuff(this, \"{0}\", \"Todo - Insert caption here\");") %&gt;'
     Text="Do stuff" /&gt;
  </code></pre>
  
  <p>i need to change: "<code>Todo - Insert caption here</code>"</p>
  
  <p>into a call to: <code>&lt;%# GetItemText((MySomething)Container.DataItem) %&gt;</code></p>
  
  <p>Blindly trying the obvious:</p>
  
  <p><strong>ASP.NET (wrapped for readability):</strong></p>
  
  <pre><code>&lt;asp:LinkButton runat="server"
     OnClientClick='&lt;%# Eval(
           "NodeGUID", 
           GetItemText((MySomething)Container.DataItem),
           "return DoStuff(this, \"{0}\", \"{1}\");") %&gt;'
     Text="Do stuff" /&gt;
  </code></pre>
  
  <p>But that complains, since Eval() only takes two parameters.</p>
  
  <hr>
  
  <p>i tried the slightly less obivous:</p>
  
  <p><strong>ASP.NET (wrapped for readability)</strong></p>
  
  <pre><code>&lt;asp:LinkButton runat="server"
     OnClientClick='&lt;%# Eval(
           "NodeGUID", 
           "return DoStuff(this, 
                 \"{0}\", 
                 \""+GetItemText((MySomething)Container.DataItem)+"\");") %&gt;'
     Text="Do stuff" /&gt;
  </code></pre>
  
  <p>But that doesn't work either.</p>
  
  <hr>
  
  <p><strong>Related Questions</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/474584/asp-net-how-to-access-repeater-generated-elements-from-javascript">ASP.NET: How to access repeater generated elements from javascript?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/480195/asp-net-how-to-access-repeater-generated-elements">asp.NET: How to access repeater generated elements?</a></p>