Hello friends i have a form view i have handele all needed events successfully but for cancel(not to insert or update) i have done the following
protected void companyForm_ItemCommand(object sender, FormViewCommandEventArgs e) { if (e.CommandName == "Cancel") { companyForm.ChangeMode(FormViewMode.ReadOnly); } }
But i have to开发者_如何学运维 twice click the button to change it in default or in read only mode please explain me y....or some other way exist to for "cancel" command
I'm pretty sure the problem is that you forgot to call the DataBind() method, try this:
protected void companyForm_ItemCommand(object sender, FormViewCommandEventArgs e)
{
if (e.CommandName == "Cancel")
{
companyForm.ChangeMode(FormViewMode.ReadOnly);
companyForm.DataSource= <THE SOURCE> ;
companyForm.DataBind();
}
}
精彩评论