User Control

  • Thread starter Charles A. Lackman
  • Start date
C

Charles A. Lackman

Hello,

I have created a User Control within Visual Studio and it contains a
button that allows the user to querry a database. I dynamically add
additional controls to the page based on the number of rows retured inside a
dataset. All works well, but I have noticed that the control is rendered
in the "Pre Render" event I loose the Control's events (i.e. button1.click).

Is there a way to render the controls in the "Pre Render" event and still
maintain the controls Events?

Dim HowMany as Int16 = 8
Dim MyControl(HowMany) As UserControl
MyControl(i) = LoadControl("ArtistControl.ascx")
Page.FindControl("Form1").Controls.Add(MyControl(i))

The Control Must be an array of controls because "HowMany" changes for each
page. If I load the control in the "Page Load" event the controls events
work. Is this a bug or am I missing something. I even added an Event
Handler to the control with no success.

Any Suggestions would be greatly appreciated,

Thanks,
Chuck
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top