日期:2014-05-20  浏览次数:20437 次

DataGrid中如何取得某行某列的值?
//响应DataGrid1的DeleteCommand事件
private   void   DataGrid1_DeleteCommand(object   source,   System.Web.UI.WebControls.DataGridCommandEventArgs   e)
{
        string   strTxt=e.Item.Cells[1].Text.ToString();
        Response.Write( " <script> alert( 'strTxt= '+ ' "+strTxt+ " '); </script> ");
}

------解决方案--------------------
DataGrid1.Items[1].Cells[1].Text.ToString();
------解决方案--------------------
private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string strTxt=e.Item.Cells[1].Text.ToString();
Response.Write(string.Format( " <script> alert( '{0} '); </script> "),strTxt);
}