如何在Gridview中删除选定的行 [英] How to delete the selected row in Gridview

查看:103
本文介绍了如何在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆