Events with Dynamic Custom Controls

M

Mike

Hi,

I have a class library (dll) in which I defined a class for a custom control (called PlaceHolder). In a separate Web project, I created a custom control (called Template.ascx) that contains three "PlaceHolder" controls, as follows:

<SIGMA:NAMINGPLACEHOLDER id="Activities" runat="server"></SIGMA:NAMINGPLACEHOLDER></td>
<SIGMA:NAMINGPLACEHOLDER id="Body" runat="server"></SIGMA:NAMINGPLACEHOLDER></td>
<SIGMA:NAMINGPLACEHOLDER id="QuickView" runat="server"></SIGMA:NAMINGPLACEHOLDER></td>

Then, in a webForm, I use the custom control "Template", as follows:

<uctemplate:template id="ucTemplate" runat="server"></uctemplate:template>

The control "Activities" is a dynamic list (built from a DB), and it populated as follows:

oWriter.Write("<a href=''>" + hyp.Text + "</a>" + "<br>");

What I would like to do now is add a "click" event to the aforementioned dynamically created control (oWriter.Write(".......")). This would allow me to load in the "Body" of the webForm the related custom control (called "MySample1.ascx", or "MySample.ascx", or "MySample3.ascx", etc.) depending on the dynamic control (list of "Activities) that was clicked.

I tried adding the event in "PlaceHolder" class (hyp.Click += new System.EventHandler(this.ActivityClicked);), in the "Template" control too, but nothing happens. What am I doing wrong here? Is it the proper way of doing this?

Thanks
Mike
 

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

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top