[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Using a custom control in a website project

Nathan Sokalski

3/27/2009 12:24:00 AM

I have a custom control (a class that inherits from System.Web.UI.Control)
that I want to use in the pages in my ASP.NET website. I know how to do this
if I compile the custom control separately into it's own *.dll, but I do not
want to create a separate *.dll for the custom control. If I put the code
for the custom control in the App_Code directory, I know it gets compiled,
but since I don't know what the assembly name is I cannot add it by
declaring it in the Web.config the way I would in a Web Application Project.
Is there a way to use a custom control in a website project without creating
a separate *.dll for the custom controls? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansok...


1 Answer

unknown

3/27/2009 1:16:00 AM

0

give it a namespace, drop it in the appcode folder and define a tag in
web.config:

<controls>
<add tagPrefix="sw" namespace="AppCode.Controls" />
</controls>

-- bruce (sqlwork.com)

Nathan Sokalski wrote:
> I have a custom control (a class that inherits from System.Web.UI.Control)
> that I want to use in the pages in my ASP.NET website. I know how to do this
> if I compile the custom control separately into it's own *.dll, but I do not
> want to create a separate *.dll for the custom control. If I put the code
> for the custom control in the App_Code directory, I know it gets compiled,
> but since I don't know what the assembly name is I cannot add it by
> declaring it in the Web.config the way I would in a Web Application Project.
> Is there a way to use a custom control in a website project without creating
> a separate *.dll for the custom controls? Thanks.