473,382 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

load dynamically UserControl

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("control es/myUserControl.ascx");
}else{
controles_myUserControlb ctrl=
(controles_myUserControlb)Page.LoadControl("contro les/myUserControlb.ascx");
}

How can I fix this problem ?

Thanks

Stan
Oct 4 '06 #1
1 1671
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)

"Stan SR" <st**@pasdepam.netsunset.comwrote in message
news:es**************@TK2MSFTNGP02.phx.gbl...
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("control es/myUserControl.ascx");
}else{
controles_myUserControlb ctrl=
(controles_myUserControlb)Page.LoadControl("contro les/myUserControlb.ascx");
}

How can I fix this problem ?

Thanks

Stan

Oct 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Josema | last post by:
Hi to all, I have a webform.aspx and inside i have a dropdown list with autopostback and a place holder... Depending of the selected index that the user selects in the dropdownlist i load a...
1
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a...
2
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation...
4
by: sebastien | last post by:
Hi, In page_load : If Not Page.IsPostBack Then Dim myUC As UserControl = LoadControl("ficheProspects.ascx") myUC.ID = "FicheProspects1" End If In another Sub i need to find my control :
2
by: Eric Falsken | last post by:
Eric Falsken <eric@db4o.com> wrote on 04 Dec 2005: > craigkenisston@hotmail.com wrote on 19 Nov 2005: > >> I'm working in the migration of an asp.net application in 1.1 to 2.0. >> I'm new to...
1
by: urs | last post by:
Two days ago, I built an ASP.NET 2.0 application and published it on a shared IIS 6 Web server. After publishing, and during the whole day, it worked fine. The server remained untouched since....
2
by: A.Wussow | last post by:
Hi Everybody, i want to load dynamically content from some user controls (with forms, or some data-controls) using atlas. So i use an UpdatePanel for loading the user control into a placeholder....
0
by: ush | last post by:
while dynamically loading usercontrol I am getting the errror - ' type 'ImageButton' must be placed inside a form tag with runat=server '. how to solve this - if a usercontrol contains...
2
by: Nick | last post by:
I have two navigation user controls and based on a query string will load one or the other. On the page that will load the user control I cannot do the following Dim uc As FlashNavigation (The...
0
abehm
by: abehm | last post by:
I have a couple placeholders in which I want to dynamically load user controls into a multi-pageview based on db data. The database returns the filename of the user control (i.e....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.