control with ID 'GridView1' could not be found for the trigger in UpdatePanel 'UpdatePanel1'
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.
精彩评论