Hi
Assuming you have both columns are databound. I have the aspx code like this
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
OnDataBound="GridView1_OnDatabound">
<Columns>
<asp:BoundField DataField="col1" HeaderText="col1" SortExpression="col1" />
<asp:BoundField DataField="cf" HeaderText="cf" SortExpression="cf" />
</Columns>
</asp:GridView>
onDatabound event I am calculating the cf and populate as follows. Again assuming the col1 is the first column and cf is the second one, otherwise you need to change the index position as per your gridview
protected void GridView1_OnDatabound(object sender, EventArgs e)
{
int cf =0;
int currentValue = 0;
foreach (GridViewRow row in GridView1.Rows)
{
currentValue = Convert.ToInt32(row.Cells[0].Text);
cf += currentValue;
row.Cells[1].Text = cf.ToString();
}
}
Let me know if that works!