我想使用DataRowView编辑gridview单元格

时间:2014-08-06 00:12:11

标签: c# asp.net

我想更新我的gridview,执行以下操作。但是,gridview中的值不会发生变化。我不确定我在做什么。

protected void grvAgents_OnRowDataBound (object sender, GridViewRowEventArgs e)
{
    if (hours)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            rowView["TotalLoginTime"] = ConvertToHours (rowView["TotalLoginTime"].ToString (), 2);
            rowView["TotalActive"] = ConvertToHours(rowView["TotalActive"].ToString(), 2);
            rowView["TotalWTime"] = ConvertToHours(rowView["TotalWTime"].ToString(), 2);
            rowView["TotalIdle"] = ConvertToHours(rowView["TotalIdle"].ToString(), 2);
            rowView.EndEdit();
            rowView.Row.AcceptChanges();
        }
    }           
}

0 个答案:

没有答案