Using a custom control in a website project

  • Thread starter Thread starter Nathan Sokalski
  • Start date Start date
N

Nathan Sokalski

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.
 
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)
 
Back
Top