ItemDataBind事件最好转化为模板列然后再设置

解决方案 »

  1.   

    cells[0]是第一列cells[1]第二列...
      

  2.   

    如果是绑定列或者直接绑定的,在Cell中就没有Control
      

  3.   

    问xhan2000:模板列?是将datagrid加载到一个panel中吗?再从panel中取吗?
      

  4.   

    string strCommand="delete "+xmnameStr+" where ruleID='"+Convert.ToString
    (e.Item.Cells[2].Text)+"'";
      

  5.   

    问icyer:我不大明白您的意思,我的datagrid中绑定的是dataset中的表:
    SqlDataAdapter da3=new SqlDataAdapter(strCommand3,myConnection);     
    DataSet ds3 = new DataSet();
    da3.Fill(ds3,"rules");
    DataGrid1.DataSource=ds3.Tables["rules"];
    DataGrid1.DataBind();请给具体指导!不胜感激!