Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack

  • Thread starter Thread starter huobazi
  • Start date Start date
H

huobazi

a uscontrol test.ascx have a dropdownlist web control the dropdownlist's
AutoPostBack property is set "true"
but when i use Loadcontrol("test.ascx") in a aspx fiel's Page_Load event the
dropdownlist which in the ascx can not run good it can not autopostback and
can not call the OnselectedChange event. help me pls~~
 
I assume you are using a dynamic control--

Be SURE the control exists when you post back to your page.
if the control doesn't exist when the page posts back, it
cannot receive the vent.

so, load the control regardless of the value
of "IsPostBack".

2ndly, do you add a handler when the control is first
rendered? you need to assign some routine to handle the
event:

AddHandler myControl.MyEvent Addressof MyEventHandler
unless you are using member-level "WithEvents" variable
for your control.
 
Back
Top