updatepanel - Setting the UniqueId of an ASP.NET control in code behind -
i have bunch of dynamically created checkboxes in code-behind so:
checkbox[] checks = new checkbox[n]; where n integer computed @ run-time. have added of these checkboxes grid, visible in asp.net webpage, want add them triggers update panel. thus, need in code-behind:
<asp:updatepanel id="uppanel" runat="server"> <contenttemplate> // ...contents of updatepanel... </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid=[insert checkbox unique id here] eventname="click" /> //... n asyncpostbacktriggers, 1 each checkbox ... <asp:asyncpostbacktrigger controlid=[insert checkbox unique id here] eventname="click" /> </triggers> </asp:updatepanel> but realize dynamically created checkboxes have no uniqueid, can't set controlid of asyncpostbacktrigger. there way set unique id of asp.net control in code-behind?
i tried far:
for (int i=0; i<n; i++) { asyncpostbacktrigger trigger = new asyncpostbacktrigger(); trigger.controlid = checks[i].uniqueid; trigger.eventname = "click"; uppanel.triggers.add(trigger); } but in debugger, see checks[i].uniqueid = "", doesn't work.
you can set id property of created controls.
Comments
Post a Comment