作者liunate (i miss you)
看板C_Sharp
标题[问题] GridViewUpdatedEventArgs取不到OldValues集合
时间Wed May 3 11:43:49 2006
各位版友好, 小弟我在GridView.Updated事件处理常式中, 想要利用GridViewUpdatedEventArgs.OldValues来取得并比较资料更新前後的不同处. 但是不管是否发生Exception, GridViewUpdatedEventArgs.OldValues都是null 不知道是不是我的用法有问题? GridViewUpdatedEventArgs.NewValues就有值.
我的程式码如下:
void TemplateProjectItemGridView_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
if (e.Exception != null)
{
this.TemplateProjectItemErrorLabel.Text = "更新专案项次失败";
e.ExceptionHandled = true;
}
if ((bool)e.OldValues["status"] == false && (bool)e.NewValues["status"] == true)
^^^^^^^^^^^^^^^^^^^null 有值^^^^^^^^^^^^^^^^^^
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "RecurringAddProjectItem", "if(window.confirm('是否根据此专案项次再次新增同样内容的专案项次?')){" + this.TemplateProjectItemInsertLinkButton.ClientID + ".click()};", true);
}
}
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.56.130.54
※ 编辑: liunate 来自: 61.56.130.54 (05/03 11:44)