Load CustomControl at runtime

G

Gabriel

Hello,

I create a user control, no problem at design time.

But when I try to load at runtime, no error but I don't see it.

The code is :

protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
_myUserControl = new myUserControl();
Page.Controls.Add(_productSearch);

}
}

Any idea why ?

Thanks,
 
S

seigo

Hi Gabriel,

Try to use LoadControl() method and do not forgot to register your
usercontrol with <%@ Register Src="" TagName="" TagPrefix="" %>

Regards,
Alex.

Gabriel напиÑав:
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top