【问题标题】:control with ID 'GridView1' could not be found for the trigger in UpdatePanel 'UpdatePanel1'在 UpdatePanel 'UpdatePanel1' 中找不到触发器的 ID 为 'GridView1' 的控件
【发布时间】:2011-01-16 00:25:21
【问题描述】:

我在更新面板中有两个网格视图,并且我在 selectedIndexChanged 事件上将条目从一个网格视图添加到另一个网格视图我试图做的是在这个事件 selectedindexchanged 上更新更新面板......但是我的网格视图在手风琴控件内,所以它没有得到已初始化,因此我收到此错误.....

在 UpdatePanel“UpdatePanel1”中找不到触发器的 ID 为“GridView1”的控件

有人知道解决办法吗?

【问题讨论】:

    标签: asp.net gridview updatepanel accordion


    【解决方案1】:

    我还没有机会对此进行测试,但这可能就是您想要的。您可能需要在 Page_Init 处动态添加触发器。像这样:

    protected void Page_Init()
        {
            AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
            trigger.EventName = "SelectedIndexChanged";
            trigger.ControlID = GridView1.UniqueID.ToString();
            UpdatePanel1.Triggers.Add(trigger);
        }
    

    尝试将其添加到 Page_Load() 的代码隐藏当代并从标记中删除触发器。

    【讨论】:

      猜你喜欢
      • 2012-08-21
      • 2011-10-03
      • 2013-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多