bool flag;
foreach(DataGridItem anItem in datagrid.Items)
{
flag=((CheckBox)anItem.FindControl("checkboxID")).Checked;  //判断是否被选中
}

解决方案 »

  1.   

    1.示例代码如下:设CheckBox的ID为Remove
    for(int i=0;i<DataGrid1.Items.Count;i++)
    {
    CheckBox chkSel=(CheckBox) DataGrid1.Items[i].FindControl("Remove");
    if (chkSel.Checked==true)
    {
    .....
    }
    }
    2.示例代码如下:设CheckBox的ID为Remove
    for(int i=0;i<DataGrid1.Items.Count;i++)
    {
    CheckBox chkSel=(CheckBox)DataGrid1.Items[i].FindControl("Remove");
    chkSel.Checked=true;
      

  2.   

    多谢hychieftain(不同) 兄弟.
    顺便问问,在问题1的那个if(chkSel.Checked==true){...}里面,
    我把其中某行的那个"数量"(在表中是aquantity属性)值返回给参数mt,
    这句话的代码怎么写啊?