title: How to store value of data binding expression into variable
body: <p>I need to access the value of a bound item several times in a template. Right now my ListView template looks like this:</p>
  
  <pre><code>&lt;asp:ListView ID="ListView1" runat="server" ItemPlaceholderID="plc"&gt;&lt;br/&gt;
   &lt;ItemTemplate&gt;&lt;br/&gt;
    &lt;input type="radio" class="myrating&lt;%# DataBinder.Eval(Container.DataItem, "Day")%&gt;" value="3" /&gt;&lt;br/&gt;
    &lt;input type="radio" class="myrating&lt;%# DataBinder.Eval(Container.DataItem, "Day")%&gt;" value="4" /&gt;&lt;br/&gt;
      &lt;/ItemTemplate&gt;&lt;br/&gt;
      &lt;LayoutTemplate&gt;&lt;br/&gt;
          &lt;div id="plc" runat="server"&gt;&lt;br/&gt;
          &lt;/div&gt;&lt;br/&gt;
      &lt;/LayoutTemplate&gt;&lt;br/&gt;
      &lt;EmptyDataTemplate&gt;&lt;br/&gt;
          No data&lt;/EmptyDataTemplate&gt;&lt;br/&gt;
  &lt;/asp:ListView&gt;&lt;br/&gt;
  </code></pre>
  
  <p>Under certain conditions I may have dozens of radio button so repeatedly calling <code>&lt;%# DataBinder.Eval(Container.DataItem, "Day")%&gt;</code> seems to be inefficient. </p>
  
  <p>I would like to assign the value of that expression to a variable and then use this variable instead so my template would look something like this</p>
  
  <pre><code>&lt;ItemTemplate&gt;&lt;br /&gt;
  &lt;%String ClassName = "myrating" + &lt;%# DataBinder.Eval(Container.DataItem, "Day")%&gt;&lt;br /&gt;
    &lt;input type="radio" class="&lt;%=ClassName %&gt;" value="3" /&gt;&lt;br /&gt;
    &lt;input type="radio" class="&lt;%="ClassName" value="4" /&gt;&lt;br /&gt;
      &lt;/ItemTemplate&gt;&lt;br /&gt;
  </code></pre>
  
  <p>This example doesn't compile but I hope you are getting the idea.</p>