復制代碼 代碼如下:
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//更新行GridViewRow
GridViewRow row = this.GridView1.Rows[e.RowIndex];
//查找更新的控件
DropDownList present = (DropDownList)row.FindControl("ddlPresent");
TextBox price = (TextBox)row.FindControl("txtPrice");
TextBox updated = (TextBox)row.FindControl("txtUpdated");
//更新
e.NewValues["present"] = present.SelectedValue;
e.NewValues["price"] = price.Text;
e.NewValues["updated"] = updated.Text;
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//更新行GridViewRow
GridViewRow row = this.GridView1.Rows[e.RowIndex];
//查找更新的控件
DropDownList present = (DropDownList)row.FindControl("ddlPresent");
TextBox price = (TextBox)row.FindControl("txtPrice");
TextBox updated = (TextBox)row.FindControl("txtUpdated");
//更新
e.NewValues["present"] = present.SelectedValue;
e.NewValues["price"] = price.Text;
e.NewValues["updated"] = updated.Text;
}
新聞熱點
疑難解答
圖片精選