开发者

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


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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜