如何在Gridview中删除选定的行 [英] How to delete the selected row in Gridview
问题描述
我使用以下代码删除gridview中的分隔行.但是Removeat函数出错.您可以解决此问题吗.
i use the following code for deleting seleted row in gridview.But the Removeat function make a error.can u solve this..advance thanks..
for(int i=0;i<GridView2.Rows.Count;i++)
{
CheckBox chkSel=(CheckBox)GridView2.Rows[i].FindControl("chkselect");
if(chkSel.Checked==true)
GridView2.Rows.RemoveAt(i);
}
错误是
``System.Web.UI.WebControls.GridViewRowCollection''不包含``RemoveAt''的定义,也没有扩展方法``RemoveAt''接受类型为``System.Web.UI.WebControls.GridViewRowCollection''的第一个参数可以找到(您是否缺少using指令或程序集引用?)
The error is
''System.Web.UI.WebControls.GridViewRowCollection'' does not contain a definition for ''RemoveAt'' and no extension method ''RemoveAt'' accepting a first argument of type ''System.Web.UI.WebControls.GridViewRowCollection'' could be found (are you missing a using directive or an assembly reference?)
推荐答案
尝试以下链接....
http://forums.asp.net/t/1105499.aspx/1 [ ^ ]
我认为这解决了您的问题.
Try the following link....
http://forums.asp.net/t/1105499.aspx/1[^]
I think it addresses your issue..
这篇关于如何在Gridview中删除选定的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!