开发者

control with ID 'GridView1' could not be found for the trigger in UpdatePanel 'UpdatePanel1'

开发者 https://www.devze.com 2022-12-20 03:04 出处:网络
I have two gridview inupdate panel and m adding entries from one gridview to another on selectedIndexChanged event what m trying to do is updating update panel on this event selectedindexchanged ...bu

I have two gridview in update panel and m adding entries from one gridview to another on selectedIndexChanged event what m trying to do is updating update panel on this event selectedindexchanged ...but my开发者_Go百科 gridview is inside accordian control so it does not get initialized and hence i get this error .....

control with ID 'GridView1' could not be found for the trigger in UpdatePanel 'UpdatePanel1'

Anybody knows solution?


I haven't had a chance to test this yet, but this might be what you're looking for. It's possible that you need to dynamically add the trigger at Page_Init. Like this:

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

Try adding that to your code-behind contemporary to Page_Load() and removing the trigger from your mark-up.

0

精彩评论

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