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

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~~
 
D

David Waz...

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top