diff <usercontrol> & usercontrol.new()

S

Sam

there's no problem when calling my usercontrol class as follows:
<%@ Register TagPrefix="User" TagName="Element" Src="~/Element.ascx" %>
<User:Element id="elmFirstElement" runat="server">

but, there is a problem when i'm calling it like this:
controls.add(new Elements())

(i'm actually filling a placeholder with a bunch of my usercontrol's)
it seems like the Elements object isn't being filled with the
webcontrols defined in the ascx file.

could someone explain me how usercontrols initialize?

thanx.

Sam.
 
S

Sam

Sam said:
there's no problem when calling my usercontrol class as follows:
<%@ Register TagPrefix="User" TagName="Element" Src="~/Element.ascx" %>
<User:Element id="elmFirstElement" runat="server">

but, there is a problem when i'm calling it like this:
controls.add(new Elements())

(i'm actually filling a placeholder with a bunch of my usercontrol's)
it seems like the Elements object isn't being filled with the
webcontrols defined in the ascx file.

could someone explain me how usercontrols initialize?

thanx.

Sam.

The solution was not to call the usercontrol.new(), but
Page.load("usercontrol.ascx")
 

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,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top