Professional Web Applications Themes

Dynamicly loaded User Control events in a Placeholder - ASP.NET Building Controls

I am having a problem of receiving UserControl events which gets dynamicly loaded within a Placeholder on a main.aspx page. If I explictly place "myControl" on the main.aspx page I can receive events and act on them, but when I dynamicly load "myControl" within a Placeholder in main.aspx.vb code-behind I can not find a way to get the events for these controls contained within the Placeholder. I am using the Placeholder on the main.aspx page for layout and because the number of usercontrols loaded will vary. Any help on this would be greatly appreciated Thanks Mike...

  1. #1

    Default Dynamicly loaded User Control events in a Placeholder

    I am having a problem of receiving UserControl events which gets dynamicly loaded within a Placeholder on a main.aspx page. If I explictly place "myControl" on the main.aspx page I can receive events and act on them, but when I dynamicly load "myControl" within a Placeholder in main.aspx.vb code-behind I can not find a way to get the events for these controls contained within the Placeholder. I am using the Placeholder on the main.aspx page for layout and because the number of usercontrols loaded will vary.

    Any help on this would be greatly appreciated

    Thanks
    Mike
    MikeM Guest

  2. #2

    Default Re: Dynamicly loaded User Control events in a Placeholder

    Mike,

    Did you get this working yet?

    I am doing the same thing as you, although I ran into a different set of
    problems
    (mostly compiler errors). Once I worked through the compiler errors the
    events worked fine (both in the placeholder method and the regular way).

    The pagelet samples in the .net sdk has an example of doing this using the
    non-code behind method (Pagelet7). There is vstudio tree with a code behind
    versions of the pagelet samples, however they do not use a PlaceHolder, they
    add to the Page object itself.

    To get code-behind + PlaceHolder approach to work, I got the non-codebehind
    version working. Created a new webform and web user control, pasted the code
    into the codebehind files. I had to add a reference to the place holder in
    the web form's codebehind module. The event handlers also had to be prefixed
    with public as well.

    I can post my example code if you (or anyone else) are insterested.

    ccallen

    "MikeM" <anonymousdiscussions.microsoft.com> wrote in message
    news:C9E3E9F2-1500-4EA5-A2C4-B0E397521A48microsoft.com...
    > I am having a problem of receiving UserControl events which gets dynamicly
    loaded within a Placeholder on a main.aspx page. If I explictly place
    "myControl" on the main.aspx page I can receive events and act on them, but
    when I dynamicly load "myControl" within a Placeholder in main.aspx.vb
    code-behind I can not find a way to get the events for these controls
    contained within the Placeholder. I am using the Placeholder on the
    main.aspx page for layout and because the number of usercontrols loaded will
    vary.
    >
    > Any help on this would be greatly appreciated.
    >
    > Thanks,
    > Mike


    ccallen Guest

Similar Threads

  1. Replies: 1
    Last Post: April 26th, 06:58 AM
  2. Dynamically Loading User Control in PlaceHolder
    By Ugur Ekinci in forum ASP.NET Building Controls
    Replies: 2
    Last Post: November 27th, 04:37 PM
  3. Getting values entered into (dynamicly loaded control)
    By Micha³ Januszczyk in forum ASP.NET Building Controls
    Replies: 4
    Last Post: March 10th, 06:39 AM
  4. UserControl not capturing Button click event when loaded with PlaceHolder Control
    By Ralph Krausse in forum ASP.NET Building Controls
    Replies: 1
    Last Post: September 15th, 09:15 PM
  5. Removing a user control from within a placeholder
    By John in forum ASP.NET General
    Replies: 1
    Last Post: July 1st, 03:11 PM

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