Reputation: 10805
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
Upvotes: 2
Views: 304
Reputation: 281
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();
}
}
Upvotes: 2