在ASP.NET GridView中 我动态生成了一个CommandField:
CommandField cf = new CommandField();
cf.ShowEditButton = true;
cf.ButtonType = ButtonType.Button;
cf.HeaderText = "编辑";
GridView1.Columns.Add(cf);
但在编辑状态中发现更新update的事件处理函数 GridView1_RowUpdating 无法调用,而“ 取消 ”的事件函数 GridView1_RowCancelingEdit 却又能用。
GridView1_RowUpdating 函数是通过GridView控件自动生成的,它内部的代码一句也不执行。太匪夷所思了,哪位朋友知道怎么回事,请不吝赐教,不胜感激!!
CommandField cf = new CommandField();
cf.ShowEditButton = true;
cf.ButtonType = ButtonType.Button;
cf.HeaderText = "编辑";
GridView1.Columns.Add(cf);
但在编辑状态中发现更新update的事件处理函数 GridView1_RowUpdating 无法调用,而“ 取消 ”的事件函数 GridView1_RowCancelingEdit 却又能用。
GridView1_RowUpdating 函数是通过GridView控件自动生成的,它内部的代码一句也不执行。太匪夷所思了,哪位朋友知道怎么回事,请不吝赐教,不胜感激!!
参考
cf.CausesValidation = false;
对比@wxr0323 发现这点不同。加上后更新操作便能用了。
谢谢了