473,511 Members | 13,105 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="FredECommerceControls"
Assembly="ECommControls" %>

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

<Fred:SiteLinks 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 3268
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="FredECommerceControls" %>

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*********@nospam.thanx.invalid> wrote in message
news:QU**************@nospamthankyou.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="FredECommerceControls"
Assembly="ECommControls" %>

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

<Fred:SiteLinks 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="FredECommerceControls" %>

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
1346
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...
8
6329
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...
4
2224
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...
8
2351
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...
2
14569
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...
5
1838
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...
2
1444
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...
1
1594
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...
1
2510
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...
0
7245
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,...
0
7144
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...
0
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7427
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5671
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3227
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...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.