Tuesday, August 20, 2013

Fixed: Error CS0030: Cannot convert type DelegateControl to IAttributeAccessor

Sometime, we get the error "error CS0030: Cannot convert type 'Microsoft.SharePoint.WebControls.DelegateControl' to 'System.Web.UI.IAttributeAccessor'" when we customize the masterpage of SharePoint. Many people think that the error comes from mis-typed or SharePoint does not recognize the control with tag name <tag:Delegate> and the solution is to remove that line. Of course, it will work correctly and you could see there is no error after that.

With my solution, there is no need to delete or remove the delegate control out of master page. The error happens because the structure of HTML for delegate control is not correct and you need to review the code to make sure that the hierarchy of HTML page is right. Sometime, there are many break-lines (the empty lines or too much enter key pressed...) also to get this error.

No comments: