OnRowDeleting事件和OnRowCommand事件之间的触发关系

同一个GridView的OnRowDeleting="ClassGridView_RowDeleting"和 OnRowCommand="ClassGridView_RowCommand"事件之间的触发关系:
当触发了OnRowDeleting事件时也会同时触发OnRowCommand事件,当触发了OnRowCommand事件时不会触发OnRowDeleting。这样一来,在OnRowCommand事件处理程序中需要判断触发的事件是什么样的事件防止因触发事件错误导致系统出错,那么可以通过e.CommandName获取前端设置的Linkbutton的CommandName进行判断。另外,在设置了OnRowDeleting的时候,LinkButton控件也可以设置CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"来传递参数。
原文地址:https://www.cnblogs.com/wangzl1163/p/6341198.html