取控件值:
string id = e.Item.Cells[0].Text;//只读绑定列
string username = ((TextBox)e.Item.Cells[2].Controls[0]).Text;//绑定列
string username = ((TextBox)e.Item.FindControl("TextBox1")).Text;
string username = ((TextBox)e.Item.FindControl("TextBox1")).Text;//模板列
绑定隐式主键:
DataGrid1.DataKeyField = "id";
int id = DataGrid1.DataKeys[e.Item.ItemIndex];