ASP.NET 无法更改 Formview 控件的可见性

发布于 2024-08-07 07:47:23 字数 200 浏览 11 评论 0原文

我觉得这很愚蠢,但到底是什么......

这是处理下拉列表事件的方法的两行:

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

它以前曾与我一起工作!现在不工作

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

年华零落成诗 2024-08-14 07:47:23

您需要使用 formview Databound 事件,例如

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

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;
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文