复制代码 代码如下:
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;
}
新闻热点
疑难解答
图片精选