开发者

ASP.NET Form View problem please have a glance

开发者 https://www.devze.com 2023-01-04 19:02 出处:网络
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

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();
         }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消