RowCreated在asp.net中更新gridview的行数据存在问题 [英] RowCreated is giving problem to update the row data of gridview in asp.net
问题描述
Hello Experts,
我在RowCreated Sub中为多列标题创建了一个动态行。我的问题是,由于这段代码,我无法编辑我的gridview行数据。当我单击编辑命令时,相应的行确实进入编辑模式,但是当我单击更新命令时,控件将进入上一行(处于编辑模式),而不是调用RowUpdating的相应方法。我能做些什么来解决这个问题? (我通过在RowCreated方法中注释代码检查了我的代码并且工作得非常好。)
谢谢。
Hello Experts,
I have created a dynamic row for a multi-column header in RowCreated Sub. My problem is that, because of this code I am not able to edit my gridview row data. When I click on edit command, the respective row does get into edit mode, but when I click on update command, then the control is going on the previous row (in edit mode) instead of calling the respective method of RowUpdating. What I can do to resolve this issue? (I have checked my code by commenting the code in RowCreated method and is working perfectly fine.)
Thank you.
推荐答案
每次更新完成后设置EditIndex 0
GridView1.EditIndex = -1;
Set EditIndex 0 after every update complete
GridView1.EditIndex = -1;
试试这个网站:
http://forums.asp.net/t/1960084.aspx?Edit+data+is+entered+into+the+variables+from+the+Gridview+row
在vb中你必须在子程序语句的末尾添加Handles及其处理的项目:
处理gvupdate.RowUpdating
Try this site:
http://forums.asp.net/t/1960084.aspx?Edit+data+is+entered+into+the+variables+from+the+Gridview+row
In vb you have to add "Handles" on the end of the subroutine statement with the item it handles:
Handles gvupdate.RowUpdating
这篇关于RowCreated在asp.net中更新gridview的行数据存在问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!