title: how to calculate the difference of two item template bind values in asp.net?
body: <p>I am not sure if i have chosen the right words to ask the question. However, Here is my code </p>
  
  <pre><code>&lt;asp:GridView ID="dgvJobCostList" runat="server" CellPadding="4" ForeColor="#333333" style="font-family:Verdana;font-size:10px;" AutoGenerateColumns="False" OnSelectedIndexChanged="dgvJobCostList_SelectedIndexChanged"&gt;
                  &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
                  &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
                  &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
                  &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
                  &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
                  &lt;EditRowStyle BackColor="#999999" /&gt;
                  &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
                  &lt;Columns&gt;
                      &lt;asp:TemplateField HeaderText="Valid From"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="lblRateEffectiveFrom" runat="server" Text='&lt;%# Bind("RateEffectiveFrom") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Shipper"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;%--&lt;asp:Label ID="lblShipperName" runat="server" Text='&lt;%# Bind("ShipperName") %&gt;'&gt;&lt;/asp:Label&gt;--%&gt;
                              &lt;%--&lt;asp:Label ID="lblShipperName" runat="server" Text='&lt;%# DataBinder.Eval(Container.DataItem, "Shipper.ShipperName") %&gt;'&gt;&lt;/asp:Label&gt;--%&gt;
                              &lt;asp:Label ID="lblShipperName" runat="server" Text='&lt;%# ((BOJobInfo)Container.DataItem).oShipper.ShipperName %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Consignee"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;%--&lt;asp:Label ID="lblConsigneeName" runat="server" Text='&lt;%# Bind("ConsigneeName") %&gt;'&gt;&lt;/asp:Label&gt;--%&gt;
                              &lt;asp:Label ID="lblConsigneeName" runat="server" Text='&lt;%# ((BOJobInfo)Container.DataItem).oConsignee.ConsigneeName %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Income"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="lblTotalIncome" runat="server" Text='&lt;%# Bind("TotalIncome") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Cost"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="lblTotalCost" runat="server" Text='&lt;%# Bind("TotalCost") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="CM1"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="lblTotalCM1" runat="server" Text='&lt;%# Bind("TotalIncome" - "TotalCost") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                  &lt;/Columns&gt;
              &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>My Problem is<br>
  1. I want to calculate the difference of Income and Cost and display the result in CM1 template.<br>
  2. I want to format the date of "RateEffectiveFrom" as "dd-MMM-yyyy" which is currently showing something similar to "dd-MM-yyyy hh:mm:ss AM/PM".<br>
  Please Help as you did before. Thanks :)</p>