[英]Sum Column value in GridView in asp.net
我正在嘗試對Gridview中的日期列求和。 請參考我的代碼。 編譯器錯誤-無法將int轉換為字符串。
請指教。
謝謝
protected void GridViewFortNight_RowDataBound(object sender, GridViewRowEventArgs e)
{
TimeSpan timeSpent = TimeSpan.Parse("00:00:00");
if (e.Row.RowType == DataControlRowType.DataRow)
{
timeSpent += TimeSpan.Parse(DataBinder.Eval(e.Row.DataItem, "TimeSheetDayTotal"));
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[4].Text = timeSpent.ToString(@"dd\:hh\:mm");
}
}
您已經在gridview頁腳中添加了標簽。 您已經計算了Gridview行更新事件。 我希望你能理解。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.