Thursday, 8 October 2015

Script Block control Error

I was creating a materpage when I got following error on publishing my masterpage:

CS0030: Cannot convert type "Microsoft.SharePoint.Webcontrols.Scriptblock" to "System.Web.UI.IAttributeAccessor".



The solution of this error was hidden in warning of debug.When I check the content of my masterpage I found some extra properties added to ScriptBlock tag. My tag looked like below:

<SharePoint:ScriptBlock runat="server" __designer:Preview="&lt;script
type=&quot;text/javascript&quot;&gt;// &lt;![CDATA[
var g_Workspace = &quot;s4-workspace&quot;; // ]]&gt;
&lt;/script&gt;" __designer:Values="&lt;P N=&#39;ID&#39; T=&#39;ctl09&#39; /&gt;&lt;P
N=&#39;Page&#39; ID=&#39;1&#39; /&gt;&lt;P N=&#39;TemplateControl&#39;
ID=&#39;2&#39; /&gt;&lt;P N=&#39;AppRelativeTemplateSourceDirectory&#39; R=&#39;-
1&#39; /&gt;"></SharePoint:ScriptBlock>

I make it simple like below and my page was working like a charm.

<SharePoint:ScriptBlock ID="ScriptBlock2" runat="server" ></SharePoint:ScriptBlock>

No comments:

Post a comment