SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

SharePoint error: Cannot convert type 'Microsoft.SharePoint.WebControls.DelegateControl' to 'System.Web.UI.IAttributeAccessor'

 I got this error today while deploying a solution to a test environment:

"CS0030: Cannot convert type 'Microsoft.SharePoint.WebControls.DelegateControl' to 'System.Web.UI.IAttributeAccessor'"

Disabling SP's custom errors and turning on callstack in the web.config revealed the following:

Line 171:                          <!-- <div id="login_box">

Line 172:                                   <SharePoint:DelegateControl id="AALogin" runat="server" ControlId="AALogin" __designer:Preview="&lt;span style=&quot;display:none&quot;&gt;&lt;/span&gt;" __designer:Values="&lt;P N='ControlId' T='TrafficDirectorLogin' /&gt;&lt;P N='ID' T='TDLogin' /&gt;&lt;P N='Page' ID='1' /&gt;&lt;P N='TemplateControl' ID='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/>Line 173:                          </div> --> 

The actual cause of the error was due to the garbage that SharePoint Designer added to the <SharePoint:DelegateControl> tag. Removing that control, which is in comments anyway, or fixing the markup solved the problem.

There's 2 quick lessons from this: (1) don't leave any controls in commented out areas - ASP.NET still processes them during the rendering methods, but the browser leaves them out; (2) Watch out for SharePoint Designer doing black magic to your HTML tags, it has the bad habit of breaking things.


Posted 01-09-2009 1:05 PM by Radi A.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.