c# - A control with ID could not be found for the trigger in UpdatePanel -



c# - A control with ID could not be found for the trigger in UpdatePanel -

i have update panel has updatemode of conditional , childrenastriggers set false. want few controls cause asynchronous postback:

<asp:updatepanel id="updpnlmain" runat="server" updatemode="conditional" childrenastriggers="false"> <contenttemplate> // ... <asp:repeater id="rptlistdata" runat="server"> <itemtemplate> <asp:button id="btnaddsomething" runat="server" onclick="btnaddsomething_click" /> </itemtemplate> </asp:repeater> // ... </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="btnaddsomething" eventname="click" /> </triggers> </asp:updatepanel>

i getting next error when seek , load page:

a command id 'btnaddsomething' not found trigger in updatepanel 'updpnlmain'.

since btnaddsomething command in repeater , might not there right away acts nonexistent. how can around this?

because command in repeater control , out of scope trigger collection. way don't need add trigger because button command in updatepanel, update when click button.

edit: there solution if want update updpnlmain updatepanel. can set in updatepanel , set button in panel. e.g.

<asp:updatepanel id="updbutton" runat="server" updatemode="conditional"> <asp:button id="btnaddsomething" runat="server" onclick="btnaddsomething_click" /> </contenttemplate>

and phone call updpnlmain.update(); method in btnaddsomething_click event.

it looking :)

c# asp.net ajax updatepanel repeater

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -