Dynamic UserControls not rendering

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After creating a custom web user control in a ascx file I can dynamically add an instance of this control to the web forms Controls collection at runtime, but it won't render. Anybody know why?
 
FYI - this is a Windows Forms Newsgroup... however:

How are you creating the instance of this control?

Are you using Control c = Page.LoadControl("my.ascx")?

- Kevin

nova_jsh01 said:
After creating a custom web user control in a ascx file I can dynamically
add an instance of this control to the web forms Controls collection at
runtime, but it won't render. Anybody know why?
 
Thanks for the response Kevin and for your suggestion. I'm not using LoadControl because my User control is actually a class, part of my project, not in a seperate file. The syntax I'm using i

Dim c As WebUserControl
Controls.Add(New WedUserControl1
c = FindControl(Controls.Item(Controls.Count - 1)).ClientID

thx
 
But is it a "UserControl" as part of an ASCX file (as you mentioned in your
original post)? Or, is it a "Server Control"?

What base class is your class inheriting from? Can you post it's contents
for further review?

- Kevin


nova_jsh01 said:
Thanks for the response Kevin and for your suggestion. I'm not using
LoadControl because my User control is actually a class, part of my project,
not in a seperate file. The syntax I'm using is
 
It is a UserControl and I'm using this syntax in my declaration:
Public Class UserControlEditEnt : Inherits UserControl

If I get a chance to recode I was going to try using the control.render
method, have u ever had to use that call?

thx
 
Back
Top