views:

585

answers:

1

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 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?

+1  A: 

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.

Byron Sommardahl