现在的位置: 首页 > 综合 > 正文

The GridView ‘gv ‘ fired event RowEditing which wasn ‘t handled.

2012年10月20日 ⁄ 综合 ⁄ 共 988字 ⁄ 字号 评论关闭

     很久没写gridview的事件代码了,刚写了个rowcommand的事件,出现下面的错误:

The   GridView   'gv '   fired   event   RowEditing   which   wasn 't   handled.  
Description:   An   unhandled   exception   occurred   during   the   execution   of   the   current   web   request.   Please   review   the   stack   trace   for   more   information   about   the   error   and   where   it   originated   in   the   code.  

Exception   Details:   System.Web.HttpException:   The   GridView   'gv '   fired   event   RowEditing   which   wasn 't   handled.

Source   Error:  

An   unhandled   exception   was   generated   during   the   execution   of   the   current   web   request.   Information   regarding   the   origin   and   location   of   the   exception   can   be   identified   using   the   exception   stack   trace   below.    

查找原因,发现要加入以下事件RowEditing :

.aspx:
<asp:GridView   ID= "GridView1 "   runat= "server "   OnRowEditing= "Editing ">
   <Columns>
     <asp:CommandField   ShowEditButton= "true "   />
   </Columns>
</asp:GridView>

.cs:
protected   void   Editing(object   sender,   GridViewEditEventArgs   e)
{
  GridView1.EditIndex   =   e.NewEditIndex;

}

其他事件,如:Delete,Cancel,Update也是相似的。

编程技巧也跟工具一样,久久不用,就会生锈。记之~~~

抱歉!评论已关闭.