NoviceToDotNet
NoviceToDotNet

Reputation: 10805

ASP.NET Form View problem please have a glance

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

Answers (1)

astorcas
astorcas

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

Related Questions