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

Discussion in 'ASP .Net' started by huobazi, Jul 2, 2003.

  1. huobazi

    huobazi Guest

    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~~
    huobazi, Jul 2, 2003
    #1
    1. Advertising

  2. huobazi

    David Waz... Guest

    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.

    >-----Original Message-----
    >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~~
    >
    >
    >.
    >
    David Waz..., Jul 3, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matteo Migliore

    Instantiate UserControl without LoadControl

    Matteo Migliore, Jun 7, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,658
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Jun 7, 2005
  2. venky

    Page Load and webcontrol page load

    venky, Jul 6, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    3,096
    venky
    Jul 11, 2005
  3. Replies:
    3
    Views:
    3,707
    Arthur
    Jun 23, 2008
  4. Luis Ramírez.

    Can a webcontrol (webcontrol.dll) have a configuration file?

    Luis Ramírez., Jul 5, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    194
    Luis Ramírez
    Jul 6, 2004
  5. Sean
    Replies:
    2
    Views:
    408
Loading...

Share This Page