load dynamically UserControl

  • Thread starter Thread starter Stan SR
  • Start date Start date
S

Stan SR

Hi,

With asp.net 2, c# I try to load UserControl on "fly".
When I test the website using VS2005, everything works.
When I try to publish the website, I get some errors like :
"The type or namespace "controles_myUserControl" could not be found (are you
missing a using directive or an assembly reference"

And here's how I code my page :

if (isfind){
controles_myUserControl ctrl=
(controles_myUserControl)Page.LoadControl("controles/myUserControl.ascx");
}else{
controles_myUserControlb ctrl=
(controles_myUserControlb)Page.LoadControl("controles/myUserControlb.ascx");
}

How can I fix this problem ?

Thanks

Stan
 
you need to add a reference (@Reference) to the user control on the page
otherwise you are counting on batch compile to include it in the same
assembly.

-- bruce (sqlwork.com)
 
Back
Top