且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从asp.net gridview中删除选定的行

更新时间:2023-02-06 23:12:54

First get row details 
GridViewRow row = CustomersGridView.Rows[e.NewSelectedIndex];
Then Delete use your delete query as per row.Cells[0].Text 





获取更多详细信息此链接


将RecordID之类的列作为数据库中的唯一/主键,并对该ID执行删除检查,因为这将允许您处理单个员工的多个记录。您也可以编辑更新并删除打孔。
Take a column like RecordID as unique/primary key in the database and perform the delete check on that id bases as this will allow you to handle multiple record of a single employee. Also you can edit update and delete the punches.


在这里使用empname删除记录,使用empid,将Empid设置为gridview的数据键。或者将emp Id设置为commmand参数删除gridview中的按钮。动态绑定gridview,即使用模板字段和项模板。
Here you delete the record using empname,in place use empid ,set Empid as datakey of gridview .Or set emp Id as the commmand argument of delete button in the gridview. Bind gridview Dynamically i.e,using Template field and Item Template.