<pre lang="cs">protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Footer)
{
Testbox t1= (Testbox )e.Row.FindControl("id of the textbox1");
Testbox t2= (Testbox )e.Row.FindControl("id of the textbox2");
Testbox t3= (Testbox )e.Row.FindControl("id of the textbox3");
Testbox t4= (Testbox )e.Row.FindControl("id of the textbox4");
float total=float.parse(t1.text+t2.text+t3.text);
t4.Text = total.tostring();
}
}
if you have any button click event do this at event
command name="calculate"
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "calculate")
{
ImageButton img = (ImageButton)e.CommandSource as ImageButton;
GridViewRow grid = img.NamingContainer as GridViewRow;
Testbox t1= (Testbox )e.Row.FindControl("id of the textbox1");
Testbox t2= (Testbox )e.Row.FindControl("id of the textbox2");
Testbox t3= (Testbox )e.Row.FindControl("id of the textbox3");
Testbox t4= (Testbox )e.Row.FindControl("id of the textbox4");
float total=float.parse(t1.text+t2.text+t3.text);
t4.Text = total.tostring();
}
}