编程论坛's Archiver

fangjunhua 发表于 2008-5-7 15:12

请大家帮帮忙!关于ASP.NET

在用c#编写一个方法,进行调试时出现如下错误:"System.Web.UI.WebControls.Gridview"并不包含"Cells"的定义。请各位高手帮帮忙,这是怎么回事?谢谢了!

该方法的功能是获取用户列表中所选中的用户。
方法程序如下:
private ArrayList GetSelected()
    {
        ArrayList selectedItems = new ArrayList();
        foreach (GridView row in GV.Rows)
        {
            if (((CheckBox)row.FindControl("chkSelected")).Checked)
            {
                selectedItems.Add(Convert.ToString(row.Cells[1].Text));
            }
        }
        return selectedItems;
    }

hebingbing 发表于 2008-5-7 15:30

foreach (GridView.Rows row in GV.Rows)

fangjunhua 发表于 2008-5-10 16:50

厉害,谢谢了!

hebingbing 发表于 2008-5-10 18:20

(*^__^*)

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.