473,587 Members | 2,548 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to reference custom control from App_Code folder?

Hello,

I have a custom control that is inside a DLL. Until now, I have had the
source file for this DLL in a development folder on my machine, and I've
been compiling it using csc on the command line. I reference the control
in the DLL on a master page by adding the line to the top of the file...

<%@ Register TagPrefix="Fred " Namespace="Fred ECommerceContro ls"
Assembly="EComm Controls" %>

....and then something like this where I want the control...

<Fred:SiteLin ks PreSep="" runat="server" />

This all worked fine, but didn't let me debug the control in VWD as it
didn't have the source file.

I tried creating an App_Code folder and putting the source file in there
(deleting the DLL from the bin folder), but this gave the following
error when I tried to run the page...

Element 'SiteLinks' is not a known element. This can occur if there is a
compilation error in the Web site.

I presume that it's not compiling the source file, so it can't find the
assembly containing the control. The question is, why? I thought the
whole idea of putting the source file in App_Code was so that it would
automatically be compiled.

Anyone any ideas? TIA

--
Alan Silver
(anything added below this line is nothing to do with me)
Feb 6 '06 #1
2 3270
If you reference it from App_Code you need to omit the Assembly part of the
Regioster directive, since it's not in an named assembly.

<%@ Register TagPrefix="Fred " Namespace="Fred ECommerceContro ls" %>

E.g just have TagPrefix and the namespace declared.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Alan Silver" <al*********@no spam.thanx.inva lid> wrote in message
news:QU******** ******@nospamth ankyou.spam...
Hello,

I have a custom control that is inside a DLL. Until now, I have had the
source file for this DLL in a development folder on my machine, and I've
been compiling it using csc on the command line. I reference the control
in the DLL on a master page by adding the line to the top of the file...

<%@ Register TagPrefix="Fred " Namespace="Fred ECommerceContro ls"
Assembly="EComm Controls" %>

...and then something like this where I want the control...

<Fred:SiteLin ks PreSep="" runat="server" />

This all worked fine, but didn't let me debug the control in VWD as it
didn't have the source file.

I tried creating an App_Code folder and putting the source file in there
(deleting the DLL from the bin folder), but this gave the following error
when I tried to run the page...

Element 'SiteLinks' is not a known element. This can occur if there is a
compilation error in the Web site.

I presume that it's not compiling the source file, so it can't find the
assembly containing the control. The question is, why? I thought the whole
idea of putting the source file in App_Code was so that it would
automatically be compiled.

Anyone any ideas? TIA

--
Alan Silver
(anything added below this line is nothing to do with me)

Feb 6 '06 #2
>If you reference it from App_Code you need to omit the Assembly part of the
Regioster directive, since it's not in an named assembly.

<%@ Register TagPrefix="Fred " Namespace="Fred ECommerceContro ls" %>

E.g just have TagPrefix and the namespace declared.


Thanks, that's great.

--
Alan Silver
(anything added below this line is nothing to do with me)
Feb 6 '06 #3

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

Similar topics

1
1355
by: Robert Zurer | last post by:
My first ASP.NET 2.0 app. I added a reference to a class library containg the types I want to as a source of data to populate my pages. The dll and all the dlls it uses appear in the newly created bin folder. I add the using directive to the page and try to call the type but I keep getting an error that a type in one temporary folder...
8
6331
by: Umut Tezduyar | last post by:
I know that, in asp.net 2.0, the assembly for the web site is splitted into pieces and each time you build it, it generates a random name for assembly. My question is, if i create a custom web control under the App_Code folder, how can i add a register tag on a page. <%@ Register TagPrefix="ABC" Namespace="ABC.Foo"...
4
2228
by: techsupport | last post by:
I have some experience with .NET Remoting, as well as ASP.NET 2.0, and have been wanting to remote a custom membership and profile provider. I want to take advantage of the new controls in ASP.NET 2.0 such as Login, Loginuser, Loginview, etc. The ASP.NET provider model requires entries in the web.config for a 'connectionStringName', which I...
8
2355
by: PJ | last post by:
How can I get a reference to the master page class? It is defined as a partial class, but I cannot seem to type a variable to the name of the partial class? The compiler continually shows "The type 'MyMaster' is not defined." I would like to reference the master page from a control, by casting the Master property of the Page property to...
2
14575
by: pradeep_TP | last post by:
Hello, I am trying to use APP_CODE folder for all my class files under VS 2005. After adding APP_CODE in the solution explorer, I added a new web page by right clicking project and selecting add new item. I expected the code behind file (Default.aspx.cs) to automatically go under APP_CODE folder, but it didnt. I tried to drag and drop the...
5
1842
by: craigkenisston | last post by:
I created a derived class from "Literal". I put the code in the App_Code folder and the control is working as expected. Now, I wan this control to be in the ToolBox, just like the others, what do I need to do ? Should it be in a separate library file to be able to get this ? Thanks in advance,
2
1456
by: kal | last post by:
I have registered my custom control in web.config as follows: <add tagPrefix="PhoenixControls" namespace="PhoenixControls" assembly="PhoenixControls"/> I have added a file called phoenixcontrols.cs to App_Code folder and in this file is this simple code: namespace PhoenixControls {
1
1599
by: realfantasy | last post by:
hi guys i have a problem regarding asp.net/vb.net, normally we make utility classes or any custom classes and put them in app_code folder but i need to put those class files outside of app_code (e.g, somewhere in root). but whenever i put up files out side of app_code they become unaccessible even i gave fully qualified name pls tell me work...
1
2517
by: chris.kennedy | last post by:
This is a little OT. I have a website which uses vb classes in the app_code folder which in turn call a data service. I want compile the app_code vb files into a separate dll (to use Sandcastle on them) with MSBuild (it's a bit of a work around). When I run my MSbuild file I need it to reference the classes created by service reference. How do...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.