简体   繁体   English

如何在gridview asp.net中更新,删除和取消行?

[英]How to Update, Delete and Cancel a row in gridview asp.net?

I have one GridView and one "Add" Button. 我有一个GridView和一个“添加”按钮。 If I click the "Add" button, one new row will be added to the GridView at the sametime I want to show "Update and Cancel" buttons in CommandField Column. 如果单击“添加”按钮,将在同一时间向GridView添加一行新行,我想在CommandField列中显示“更新和取消”按钮。 When I click the Update Button after the Insertion of the New Row, I want to Show the Delete Button in the Command Field Column. 当我插入新行后单击更新按钮时,我想在命令字段列中显示删除按钮。 Once again When I click the Delete Button, the Corresponding row will have to be deleted. 再次单击“删除”按钮时,必须删除“对应”行。

So far I have done all the four things(update, cancel, edit and delete) at the same. 到目前为止,我已经完成了所有这四件事(更新,取消,编辑和删除)。 But now I dont want Edit. 但现在我不想要编辑。 The problem is when I include "ShowDeleteButton = True" in the command field, the "update and cancel" buttons are not displaying when I click the "Add" button. 问题是当我在命令字段中包含“ShowDeleteButton = True”时,单击“添加”按钮时不显示“更新和取消”按钮。 The "update cancel" buttons are displaying only when I include "ShowEditButton = true". 仅当我包含“ShowEditButton = true”时,才会显示“更新取消”按钮。 But I dont want to Edit the Column. 但我不想编辑专栏。 Any one please help me. 任何人请帮助我。

Here I want only to do Update, Cancel and Delete. 在这里,我只想做更新,取消和删除。 How to do? 怎么做? I dont want coding, I have written all the coding parts in Gridview_Rowupdating and RowDeleting Event. 我不想编码,我已经在Gridview_Rowupdating和RowDeleting事件中编写了所有编码部分。

Here is my GridView's Command Field Column. 这是我的GridView的命令字段列。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM