Asp.net FormView在更新后不会更改为只读模式?为什么?
更新记录后,它不会进入只读模式。更改模式后,您必须重新绑定。因此,提供数据源并调用DataBind()Asp.net FormView在更新后不会更改为只读模式?为什么?,asp.net,Asp.net,更新记录后,它不会进入只读模式。更改模式后,您必须重新绑定。因此,提供数据源并调用DataBind() HTH.Bluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu。 protected void FormView1_ModeChanging(object sender, FormViewModeEventArgs e) { this.FormVie
HTH.Bluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu。
protected void FormView1_ModeChanging(object sender, FormViewModeEventArgs e)
{
this.FormView1.ChangeMode(e.NewMode);
}
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
int id = int.Parse(e.CommandArgument.ToString());
TextBox text1 = (TextBox)FormView1.FindControl("txtNameEdit");
TextBox text2 = (TextBox)FormView1.FindControl("txtStatusEdit");
comp.UpdateRecord(text1.Text, int.Parse(text2.Text), id);
ds = BindGridView();
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
{
FormView1.ChangeMode(FormViewMode.ReadOnly);
}