Professional Web Applications Themes

Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack - ASP.NET General

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

  1. #1

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

    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 Guest

  2. #2

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

    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... Guest

Similar Threads

  1. Howto load a usercontrol from App_Code
    By Msdn in forum ASP.NET Building Controls
    Replies: 0
    Last Post: September 5th, 10:47 AM
  2. Event not firing in usercontrol inside usercontrol
    By vatech1993@yahoo.com in forum ASP.NET Building Controls
    Replies: 4
    Last Post: February 28th, 02:25 PM
  3. onserverclick in a usercontrol inside of a webcontrol
    By John Giblin in forum ASP.NET Building Controls
    Replies: 2
    Last Post: August 7th, 10:01 PM
  4. Adding a usercontrol to a WebControl
    By John Giblin in forum ASP.NET Building Controls
    Replies: 0
    Last Post: August 5th, 08:35 PM
  5. Problem with WebControl and dynamic UserControl..
    By Rocky Moore in forum ASP.NET Building Controls
    Replies: 3
    Last Post: July 22nd, 07:34 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139