asp.net - Creating UpdatePanel dynamically for a custom control is causing a full post back -
i've been jammed on day now. need create custom control, , proof of concept, trying create updatepanel , add button it. it causes full page post back.
code (custom control):
imports system.text imports system.web.ui imports system.web.ui.webcontrols imports system.componentmodel imports ajaxcontroltoolkit <designer(gettype(hmxicdsearchtooldesigner))> _ public class hmxicdsearchtool inherits hmxisbasecompositecontrol implements inamingcontainer private const default_width integer = 650 private const default_height integer = 450 private _pnlupdate updatepanel = nothing private _btntest button = nothing private _lbl label = nothing protected overrides sub createchildcontrols() mybase.createchildcontrols() _pnlupdate = new updatepanel() _pnlupdate .id = "pnlupdate" .childrenastriggers = false .updatemode = updatepanelupdatemode.conditional end _btntest = new button() _btntest .id = "btntest" .text = "test button" .causesvalidation = false addhandler .click, addressof btn_click end _lbl = new label() _lbl .id = "lbl" .text = "hello!" end _pnlupdate.contenttemplatecontainer.controls.add(_btntest) _pnlupdate.contenttemplatecontainer.controls.add(_lbl) dim atrigger asyncpostbacktrigger = new asyncpostbacktrigger() atrigger .controlid = "btntest" .eventname = "click" end me._pnlupdate.triggers.add(atrigger) me.controls.add(_pnlupdate) me.style.add("background-color", "red") me.height = 500 me.width = 500 end sub protected sub btn_click(byval sender object, byval e system.eventargs) if not me.page.ispostback me._lbl.text = "async postback." end if end sub end class any thoughts appreciated. have tried toggling childrenastriggers, putting code in me.load, among other things.
it performing partial postback whole time.
i made mistake of testing see if partial postback so:
if page.ispostback 'something here end when should have been checking this
me.scriptmanager.isinasyncpostback this: page.ispostback true if performing partial postback.
Comments
Post a Comment