Using a custom control in a website project

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.
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top