Wednesday, March 21, 2012

A control with ID ImageButton5 could not be found for the trigger in UpdatePanel up1.

I have 20 ImageButtons on my page and UpdatePanel . In Update Panel Triggers i've added all this buttons

<asp:AsyncPostBackTriggerControlID="IB1"/>

<asp:AsyncPostBackTriggerControlID="ImageButton1"/>

<asp:AsyncPostBackTriggerControlID="ImageButton2"/>

<asp:AsyncPostBackTriggerControlID="ImageButton3"/>

<asp:AsyncPostBackTriggerControlID="ImageButton4"/>

<asp:AsyncPostBackTriggerControlID="ImageButton5"/> Here I am Getting this Message

A control with ID 'ImageButton5' could not be found for the trigger in UpdatePanel 'up1'.

4 first Image Buttons update panel can find but after 5th no ..... What can be the problem ??

Please post your source code so we can see it in the context of the entire page.


Post some more code details, So it will be more helpful


<asp:UpdatePanelID="up1"UpdateMode="Conditional"runat="server"ChildrenAsTriggers="True">

<Triggers>

<asp:AsyncPostBackTriggerControlID="IB1"/>

<asp:AsyncPostBackTriggerControlID="ImageButton1"/>

<asp:AsyncPostBackTriggerControlID="ImageButton2"/>

<asp:AsyncPostBackTriggerControlID="ImageButton3"/>

<asp:AsyncPostBackTriggerControlID="ImageButton4"/>

<asp:AsyncPostBackTriggerControlID="ImageButton5"/>

</Triggers>

<ContentTemplate>

This is Update Panel code :

and there are just 20 ImageButtons on form ... thats all code


Seeing the rest of the page would really help.


Hi,

Thank you for your post!

Where is yourImageButton5? Is it in anothernaming container?

You cann't set button that is in a different naming container with the updatepanle as a trigger. That is the answer.

If you really want it to be a trigger, this is the workaround:

Programmatically addingAsyncPostBackTrigger controls is not supported. Find out the control viafindcontrol method, then use theRegisterAsyncPostBackControl(Control) method of theScriptManager control to programmatically register a postback control, and then call theUpdate() method of theUpdatePanel when the control posts back.

If you have further questions,let me know!

Best Regards,


Thanks a lot for your reply ...

I am sorry for my dummy knowlege but what does it meananothernaming container ?

my button is on the same page in same <table> but in different <tr> , this could be a problem ?


Hi,

Thank you for your feedback!

Seehttp://msdn2.microsoft.com/en-us/library/system.web.ui.inamingcontainer.aspx.

INamingContainer Interface

Identifies a container control that creates a new ID namespace within aPage object's control hierarchy. This is a marker interface only.

Naming container is a container contorl which implemented the INamingContainer Interface, contorls in Naming container 2 have different ID namespace with contorls in Naming container 1, so ....

If you have further questions, let me know.

Best Regards,

No comments:

Post a Comment