:“TextBox”是不明确的引用你没有引入System.Web.UI.WebControls命名空间。可以下面那样用。。
void MyDataGrid_Update(Object sender, DataGridCommandEventArgs e) 
      {
         // For bound columns, the edited value is stored in a TextBox.
         // The TextBox is the 0th element in the column's cell.
System.Web.UI.WebControls.TextBox qtyText = (System.Web.UI.WebControls.TextBox)e.Item.Cells[2].Controls[0];
System.Web.UI.WebControls.TextBox priceText= (System.Web.UI.WebControls.TextBox)e.Item.Cells[3].Controls[0];或者:
如果程序在.cs中:
using System.Web.UI.WebControls;
void MyDataGrid_Update(Object sender, DataGridCommandEventArgs e) 
      {
         // For bound columns, the edited value is stored in a TextBox.
         // The TextBox is the 0th element in the column's cell.
         TextBox qtyText = (TextBox)e.Item.Cells[2].Controls[0];
         TextBox priceText = (TextBox)e.Item.Cells[3].Controls[0];在ASPX中:<%@Import Namespace="System.Web.UI.WebControls"%>
void MyDataGrid_Update(Object sender, DataGridCommandEventArgs e) 
      {
         // For bound columns, the edited value is stored in a TextBox.
         // The TextBox is the 0th element in the column's cell.
         TextBox qtyText = (TextBox)e.Item.Cells[2].Controls[0];
         TextBox priceText = (TextBox)e.Item.Cells[3].Controls[0];