Question DataGridView - Adding column values

davebhoy

Active member
Joined
Aug 22, 2006
Messages
26
Programming Experience
1-3
Hi

I would like to add two column values in a third column and I thought that a template field was the way to do this but maybe I'm wrong, I tried this

<asp:BoundField DataField="exp_budget2_cy" DataFormatString="{0:#,##0;(#,##0);0}" HeaderText="CY Budget Revised"
ReadOnly="True" SortExpression="exp_budget2_cy">
<ItemStyle HorizontalAlign="Right" Wrap="False" />
<HeaderStyle HorizontalAlign="Center" Width="80px" />
</asp:BoundField>
<asp:BoundField DataField="exp_adjust" HeaderText="NY Adjustment" SortExpression="exp_adjust" DataFormatString="{0:#,##0;(#,##0);0}">
<ItemStyle HorizontalAlign="Right" Wrap="False" />
<HeaderStyle HorizontalAlign="Center" Width="80px" />
</asp:BoundField>
<asp:TemplateField HeaderText="NY Proposed Budget">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server"></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# ("exp_budget2_cy"+"exp_adjust", "{0:#,##0;(#,##0);0}") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" Width="80px" />
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>

Any advice would be much appreciated. Thanks

Dave
 
I don't really work with Web Forms so I don't really know the answer to your question. I saw the title of this thread and didn't notice the forum it was in. The DataGridView is a Windows Forms control, so I expected a Windows Forms question. As you're using Web Forms, you must not be using a DataGridView. More likely you are using a GridView. It's important to use the correct names for things to avoid confusion.
 
Back
Top