How do i change the DataItem “AmountCollected” in a GridView to something else in Code Behind. I want to change the DataItem to Balance depending on some condition and i was wondering if it can be done?!! This is using VS 2005 using c# and HTML.
Thanks in Advance!!
<asp:TemplateField ItemStyle-Width="70" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
$<asp:Label ID="lblTotalCollected" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"AmountCollected") %>'></asp:Label>
</ItemTemplate>
Set up an
RowDataBoundevent for theGridView. That event will run for each item in your datasource, and you can modify each row based on your criteria.