"Unknown server tag 'cms:LocalizedLabel'" error in 'Design' mode in VisualStudio

This article describes how to remove following error message that may appear in  'Design' mode in VisualStudio for some web parts placed on ASPX template: An unhandled exception has occurred. Unknown server tag 'cms:LocalizedLabel'

This issue is caused by VisualStudio seems not to be able to recognize assembly of nested control when the assembly is specified in web.config (default 'cms' prefix). This issue doesn't have impact on functionality of web part. Anyway, you can solve it by registering appropriate namespace manually in appropriate control. Please see example bellow:

1) This issue happens e.g. for 'Poll1' web part on ~\CMSTemplates\CorporateSiteASPX\WebParts\Polls.aspx sample template.

2) In the code of template you can find that the source of the web part is ~/CMSWebParts/Polls/poll.ascx.

3) In the code of Poll web part you can find there is ~/CMSModules/Polls/Controls/PollView.ascx control used

4) You can add following code at second line (under '<%@ Control ...' line) of ~/CMSModules/Polls/Controls/PollView.ascx control (you can see there are 'cms:LocalizedLabel' controls used in this control):

<%@ Register Namespace="CMS.ExtendedControls" Assembly="CMS.ExtendedControls" TagPrefix="cms" %>

5) Now the ~\CMSTemplates\CorporateSiteASPX\WebParts\Polls.aspx should be displayed correctly in 'design' mode of VS.

See also:

Applies to: Kentico CMS 4.0
Share this article on   LinkedIn