ASP.NET无法更改FormView控件的可见性 [英] ASP.NET Can not Change Visibility of a Formview control

查看:233
本文介绍了ASP.NET无法更改FormView控件的可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得这是愚蠢的,但什么是地狱......

I feel this is stupid, but what the hell...

这是两行处理一个DropDownList事件的方法:

this is two lines of a methods that handles a dropdownlist event:

        resolve = (Button)FormView1.FindControl("btn_resolve");
        resolve.Visible = true;

它曾经与我早期的工作!现在没有工作

It used to work with me earlier! Not working now

推荐答案

您需要使用FormView控件数据绑定事件像

you need to use formview Databound event like

 protected void FormView1_DataBound(object sender, EventArgs e)
{
    if (FormView1.CurrentMode == FormViewMode.Edit)
    {
        btn_resolve = (Button)FormView1.FindControl("btn_resolve");
        resolve.Visible = true;
    }
}

这篇关于ASP.NET无法更改FormView控件的可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆