Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Dynamicly loaded User Control events in a Placeholder

Reply
Thread Tools

Dynamicly loaded User Control events in a Placeholder

 
 
MikeM
Guest
Posts: n/a
 
      04-09-2004
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
 
Reply With Quote
 
 
 
 
ccallen
Guest
Posts: n/a
 
      04-12-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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




 
Reply With Quote
 
 
 
 
MikeM
Guest
Posts: n/a
 
      04-19-2004
Yes, I found that I needed to add an EventHandler in the UserControl code behind file and add a handler on the main.aspx.vb codebehind for the dynamicly added usercontrol

Thanks
Mike

----- ccallen wrote: ----

Mike

Did you get this working yet

I am doing the same thing as you, although I ran into a different set o
problem
(mostly compiler errors). Once I worked through the compiler errors th
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 th
non-code behind method (Pagelet7). There is vstudio tree with a code behin
versions of the pagelet samples, however they do not use a PlaceHolder, the
add to the Page object itself

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

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

ccalle

"MikeM" <(E-Mail Removed)> wrote in messag
news:(E-Mail Removed)..
> I am having a problem of receiving UserControl events which gets dynamicl

loaded within a Placeholder on a main.aspx page. If I explictly plac
"myControl" on the main.aspx page I can receive events and act on them, bu
when I dynamicly load "myControl" within a Placeholder in main.aspx.v
code-behind I can not find a way to get the events for these control
contained within the Placeholder. I am using the Placeholder on th
main.aspx page for layout and because the number of usercontrols loaded wil
vary
>> Any help on this would be greatly appreciated
>> Thanks

> Mik





 
Reply With Quote
 
Jonathan Roberts
Guest
Posts: n/a
 
      04-25-2004
I would be interested to see your code, as I have being trying to get
dynamically added usercontrol events initiating parent Webform
eventhandlers.
If that all makes sense.
Regards Jonathan Roberts
"ccallen" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I pass parameters to a user control that is loaded at into a Placeholder at runtime? keith ASP .Net 9 08-08-2008 05:09 AM
Getting values entered into (dynamicly loaded control) Micha³ Januszczyk ASP .Net Web Controls 1 03-17-2005 02:14 PM
Getting values entered into (dynamicly loaded control) Micha³ Januszczyk ASP .Net Building Controls 4 03-10-2005 06:39 AM
Problem with dynamicly added buttons in PlaceHolder dotNet ASP .Net Web Controls 0 02-15-2005 11:39 AM
Build control in a placeholder or like a placeholder nail ASP .Net Building Controls 0 09-10-2004 07:57 PM



Advertisments