在DataGridView中删除行 [英] Delet Row in DataGridView
本文介绍了在DataGridView中删除行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用下面的代码来删除datagridview中的行,但它不会删除行,直到计算它正在删除某行未取消删除我的代码是
Hi,
I am using below code to delete row in datagridview but it is not deleting row till count it is lefting some row undeleted my code is
AppiRow=datagridview.currentcell.rowindex;
for (int AppiLib_Count = 0; AppiLib_Count < AppiLib.Count; AppiLib_Count++)
{
dataGrid.Rows.RemoveAt(AppiRow);
AppiRow++;
}
请帮忙...
please help on this..
推荐答案
例如
你可以使用
for example
you can use
OnRowDeleting="Countrylist_Rowdelete"
gridview的方法
IN .cs文件
method of gridview
IN .cs file
protected void Countrylist_Rowdelete(object sender, GridViewDeleteEventArgs e)//TO DELETE PARTICULAR RECORD SELECTED FROM GRID
{
int intCode = Convert.ToInt32(Countrylist.DataKeys[e.RowIndex].Value);
strQuery = "DELETE FROM Country_master " +
"WHERE CountryId=" + intCode + "";
OpenConn();
OleDbCommand oledbcmd = new OleDbCommand(strQuery, con);
oledbcmd.ExecuteNonQuery();
Display();//function that binds your gridview
}
希望这可以帮到你
Happy Coding:)
Hope this may help you
Happy Coding :)
hi,
查看此链接是否有错误
http://msghelp.net/showthread.php?tid=91063 [ ^ ]
和
删除没有数据库的gridview行
check
添加/删除gridview中没有数据库的行 [ ^ ]
< a href =http://www.codeproject.com/Questions/356366/gridview-row-deletion-without-database>没有数据库的gridview行删除 [ ^ ]
http://bytes.com/topic/net/answers/ 828749-how-delete-row-gridview-without-database [ ^ ]
快乐编码:)
check this link for your error
http://msghelp.net/showthread.php?tid=91063[^]
and
to delete gridview row without database
check
Add/Delete rows from gridview without database[^]
gridview row deletion without database[^]
http://bytes.com/topic/net/answers/828749-how-delete-row-gridview-without-database[^]
Happy Coding :)
这篇关于在DataGridView中删除行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文