开发者

Custom control in a .net web application project

开发者 https://www.devze.com 2022-12-08 12:55 出处:网络
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 on

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开发者_StackOverflow 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.


Did you add the tag prefix to web.config?

<pages>
  <controls>
    <add tagPrefix="CustomControls" namespace="MyApp.CustomControls" ...


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

0

精彩评论

暂无评论...
验证码 换一张
取 消