Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom control in a .net web application project

I have a few custom controls that were created as Server Controls projects. I had a few changes to make, so I just added the classes to an existing Web Application project so I could have things in one place. This web app project is compiled into a dll that is used on several web projects.

When I build the web app project and place the dll in the bin of a different website, when I go to use the control I get the following error:

Unknown server tag 'CustomControls:RadioButtonListForGrid'

If I add the custom control classes to the app_code folder of my website it works fine. I used the object browser and confirmed that these classes are in the dll.

Am I missing something obvious here? Do I have to leave these as Server Control projects and combine the dlls using ILmerge?

EDIT

Turns out that I needed to add the assembly name. It also turns out that the assembly wasn't named what I thought it was. Guess I should of checked that. Oops.

like image 915
ScottE Avatar asked Oct 07 '09 21:10

ScottE


2 Answers

Did you add the tag prefix to web.config?

<pages>
  <controls>
    <add tagPrefix="CustomControls" namespace="MyApp.CustomControls" ...
like image 106
Robert Harvey Avatar answered Sep 23 '22 10:09

Robert Harvey


I can confirm it, adding assembly name in the Register directive works! So it's a must even if it's the same assembly.

like image 34
AugustinJuricic Avatar answered Sep 23 '22 10:09

AugustinJuricic