如何在按钮单击时删除已检查的记录 [英] how to Delete checked records on button click
本文介绍了如何在按钮单击时删除已检查的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的网格
删除(chkbox col)名称地址手机
raj mumbai 9999999999
sri delhi 8888888888
i在网格中有10条记录。
我想删除已选中复选框的记录,我该如何实现此任务? 。
提前谢谢。
解决方案
看看这个..
从datgridview和数据库访问中删除行 [ ^ ]
我希望这能帮到你!
int index = GridView1.SelectedIndex;
gv.DeleteRow(index); // 使用gridview实例的deleterow方法(gv是你的gridview实例)
从数据表中删除
DataTable dt = new DataTable(); // 您的数据表实例
// index = dt.Rows.IndexOf(dr); //获取指定行的索引
dt.Rows [index] .Delete(); // 删除行
更多方法:
dt.Rows.RemoveAt(index ); // 如果您知道行索引
// dt.Rows.Remove(dr); //如果你有指定行的实例
一些帮助你的链接:
如何:删除DataTable中的行
GridView删除行
GridView删除,确认
GridView.DeleteRow方法
I have Grid like this
Delete(chkbox col) name address mobile
raj mumbai 9999999999
sri delhi 8888888888
i have ten records in grid.
I want to delete records of checked checkbox , how can i achieve this task?.
thanks in advance.
解决方案
Have a look at this one..
Delete rows from datgridview and database access[^]
i hope this help you!
int index=GridView1.SelectedIndex; gv.DeleteRow(index);// use deleterow method of gridview instance (gv is your gridview instance)
Delete from datatable
DataTable dt = new DataTable();// your datatable instance //index=dt.Rows.IndexOf(dr); //get index of specified row dt.Rows[index].Delete();//delete the row
more ways :
dt.Rows.RemoveAt(index);//use this if you know index of row //dt.Rows.Remove(dr);//use this if you have instance of specified row
some link to help you:
How to: Delete Rows in a DataTable
GridView Delete Row
GridView Delete, with Confirmation
GridView.DeleteRow Method
这篇关于如何在按钮单击时删除已检查的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文