Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

sum total time in grid view footer

barakkadoshbarakkadosh israelMember Posts: 1

hii to all
i am new with c#
i am tray to calculate time in grid view footer
i do it with integer but with time i dont know how to do it
i post code and picture
i need some help please
` int TotalQuantity = 0;
DateTime dt = new DateTime();
TimeSpan ts();
//double totaltime = 00.00;

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        TotalQuantity += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Quantity"));
       // totaltime += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Time"));


    }
    else if (e.Row.RowType == DataControlRowType.Footer)
    {
        e.Row.Cells[0].Text = "TotalQuantity";
        e.Row.Cells[0].Font.Bold = true;

        e.Row.Cells[1].Text = TotalQuantity.ToString();
        e.Row.Cells[1].Font.Bold = true;

        e.Row.Cells[2].Text = "TotalTime";
        e.Row.Cells[2].Font.Bold = true;

        e.Row.Cells[3].Text = dt.ToShortTimeString();
        e.Row.Cells[3].Font.Bold = true;
    }
}`
Sign In or Register to comment.