[問題] GridViewUpdatedEventArgs取不到OldValues集合

看板C_Sharp (C#)作者 (i miss you)時間19年前 (2006/05/03 11:42), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
各位版友好, 小弟我在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)
文章代碼(AID): #14M2QzG7 (C_Sharp)
文章代碼(AID): #14M2QzG7 (C_Sharp)