title: How to show the Item Total using ASP.NET Eval instead of ModelBinding?
body: <p>I am new ASP.NET Web Forms developer and I am using ASP.NET 4.5. I am struggling right now with converting a statement from using a ModelBinding to Eval as I am using ObjectDataSource. </p>
  
  <p>The ASP.NET line of code:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Item Total"&gt;
      &lt;ItemTemplate&gt;
          &lt;%#: String.Format("{0:c}", ((Convert.ToDouble(Item.Quantity)) *  Convert.ToDouble(Item.Product.UnitPrice)))%&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>instead of using ModelBinding and saying Item.Quantity or Item.Product.UnitPrice, I would like to use Eval statement as this line of code is included in ASP.NET GridView which is bound to ObjectDatasSource. So how can I do that?</p>
  
  <p>I tried to do it as follows:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Item Total"&gt;
      &lt;ItemTemplate&gt;
  &lt;%# String.Format("{0:C}", Double.Parse(DataBinder.Eval(Container.DataItem, "Quantity").ToString()))  %&gt;
   *  
  &lt;%# String.Format("{0:C}", Double.Parse(DataBinder.Eval(Container.DataItem, "TTSF_Product.UnitPrice").ToString()))  %&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>but unfortunately it gave me the following result: </p>
  
  <blockquote>
    <p>$4.00 * $22.50</p>
  </blockquote>
  
  <p>instead of doing the mathematical calculation and I don't why. <strong>So how can I fix that line of code?</strong></p>
  
  <p>Thanks in advance for your help.</p>