求助!!
gridview的编辑功能protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
OleDbConnection conn;
conn = DB.DBconntionadmin();
conn.Open();
string ID = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
//GridViewRow row = this.GridView1.Rows[e.RowIndex]; //定义更新行对象
string username = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[0].Controls[0])).Text;
string userpwd = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text;
string popedom = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text;
//string sql3 = "update admin set username='" + ((TextBox)(row.Cells[0].Controls[0])).Text.ToString() + "' and userpwd='" + ((TextBox)(row.Cells[1].Controls[0])).Text.ToString() + "' and popedom='" + ((TextBox)(row.Cells[2].Controls[0])).Text.ToString() + "' where id=" + ID;
string sql3 = "update admin set username='" + username + "' and userpwd='" + userpwd + "' and popedom='" + popedom + "' where id=" + ID;
OleDbCommand com = new OleDbCommand(sql3, conn);
com.ExecuteNonQuery();
GridView1.EditIndex = -1;
conn.Close();
getbinder();
在红色字体处报错
无法将类型为“System.Web.UI.WebControls.DataControlLinkButton”的对象强制转换为类型“System.Web.UI.WebControls.TextBox”。