GridView的'GridView1'触发了未处理的事件RowEditing。 [英] The GridView 'GridView1' fired event RowEditing which wasn't handled.

查看:340
本文介绍了GridView的'GridView1'触发了未处理的事件RowEditing。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我在我的.aspx页面中使用了gridview,我想通过从gridview中选择id来编辑记录,在my.aspx页面上显示该id,在选择了这个id之后在dropdownlist中传输这些值,并从那里我想要更新,但是当我点击编辑按钮时,它会给出错误。GridView''GridView1''触发了事件RowEditing,但没有处理。

Hi Everyone, i am using a gridview in my .aspx page,i want to edit the record by selecting the id from the gridview , that display on the page load in my.aspx page,after selection of the id this wiil be transfer these value in dropdownlist.and from there i want to update, but when i click on the edit button ,then it give error."The GridView ''GridView1'' fired event RowEditing which wasn''t handled.
"

推荐答案

以下是正确的答案,如果您正在使用命令进行编辑并获得此错误。

感谢Sasikala Gurusamy



只需将编辑按钮的CommandName属性从Edit更改为EditRow(或其他与您相关的东西,但制作确定它不是编辑)。现在令人惊讶的是代码工作正常。
BELOW IS THE CORRECT ANSWER IF YOU ARE USING ROW COMMAND FOR EDITING AND GETTING THIS ERROR.
THANKS Sasikala Gurusamy

Just change the "CommandName" property of the "Edit" button from "Edit" to "EditRow"(or something else which is relevent to you but make sure it is not "Edit"). Now surprisingly the code works fine.


你必须在RowUpdating事件中编写代码以在gridview中编辑行

You have to write code on RowUpdating Event for edit row in gridview
 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
 {
GridView1.EditIndex = e.NewEditIndex;
BindGrid();
}

protected void GridView1_RowUpdating(object sender, GridViewEditEventArgs e)
   {
 // Write here code for edit Rows 
   }


只需从编辑更改编辑按钮的CommandName属性到EditRow(或其他与你相关的东西,但确保它不是编辑)。现在令人惊讶的是代码工作正常。



Just change the "CommandName" property of the "Edit" button from "Edit" to "EditRow"(or something else which is relevent to you but make sure it is not "Edit"). Now surprisingly the code works fine.

Some other GridViews reserved key words and their default associated events are as follow :
    "Cancel" - Raises the RowCancelingEdit event.
    "Delete"  - Raises the RowDeleting and RowDeleted events.
    "Edit" - Raises the RowEditing events.
    "Page" - Raises the PageIndexChanging and PageIndexChanged events.
    "Select" - Raises the SelectedIndexChanging and SelectedIndexChanged events.
    "Sort" - Raises the Sorting and Sorted events.
    "Update" - Raises the RowUpdating and RowUpdated events.


这篇关于GridView的'GridView1'触发了未处理的事件RowEditing。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆