Home » Posts tagged "Container.DataItem"

Archive for the 'Container.DataItem' Tag

GridView Amount Difference

Simple amount difference code in GridVeiw <asp:TemplateField> <ItemTemplate> <%# FormatCurrency(Convert.ToString(Container.DataItem(“Amount1”)-Container.DataItem(“Amount2”)))%> </ItemTemplate> </asp:TemplateField>

Databinder.Eval and Container.DataItem (VB)

Array of Strings: <%# Container.DataItem %> Field from DataView: <%# Container.DataItem(“FirstName”) %> Collection of objects: <%# Container.DataItem.FirstName %> Example <a href='<%#  Databinder.Eval(Container.DataItem,”ID”,”default.aspx?CategoryId={0}” ) %>’> In case you use jQuery or Colorbox to open in a new window, here is example: <a class=”colorbox1”  href='<%# “default.aspx?CategoryId=” + Cstr(Databinder.Eval(Container.DataItem, “CustomerID”))%>’> Recordset line number <%#Container.DataItemIndex + 1%>.