邀请高手会诊:数据删除问题?
在模板列加入到datagrid   中,现在的情况是,选定该行时候为什么下面的dg.Cells[1].Text   是空,但是DataGrid1已经有值了,很急,谢了 
    protected   void   delete(object   source,   DataGridCommandEventArgs   e) 
             { 
                         foreach   (DataGridItem   dg   in   DataGrid1.Items   ) 
                         { 
                                     CheckBox   chk   =   (CheckBox)dg.FindControl( "CHK ");                                       
                                     if   (chk.Checked   ==   true) 
                                     { 
                                                 string   conn   =    "server=.;database=DBFILE;trusted_connection   =   yes "; 
                                                 SqlCommand   sqlcmd   =   new   SqlCommand(); 
                                                 sqlcmd.Connection   =   new   SqlConnection(conn); 
                                                 string   str1   =    "delete   from   authoritytbl   where   AuthorityID   =    "; 
                                                 string   str2   =   dg.Cells[1].Text   ;
------解决方案--------------------设一个断点看看dg.Cells里面都有啥...
------解决方案--------------------vclassDGD.DataKeys[e.Item.ItemIndex].ToString();//把数据存到DataKeys时用 
 ((TextBox)(e.Item.Cells[1].Controls[0])).Text.Trim();//一般在有e.Item的情况下用