I have a web application with 2 projects: the website itself and a project containing custom server controls.
I referenced the server control project in my web app, and added this to my web.config:
<pages>
<controls>
<add assembly="ServerControls" tagName="MyControl" tagPrefix="sc" namespace="ServerControls" />
</controls>
</pages>
But how do I use the control? It’s not showing up in the toolbox or intellisense and is giving me an error when I start it up in the web.config.
First you need to check that your custom control class is marked public or it will not be visible from outside the assembly.
Then just reference it in the page like this:
You shouldn’t need a Register directive on the page because you have already registered the tag prefix in the web.config.