Sunday, February 28, 2010

Error: Code blocks are not supported in this context

Error: Code blocks are not supported in this context
Stack Trace: at System.Web.UI.ControlBuilder.AppendSubBuilder(ControlBuilder subBuilder) at System.Web.UI.TemplateParser.AppendSubBuilder(ControlBuilder builder, ControlBuilder subBuilder) at System.Web.UI.TemplateParser.ProcessCodeBlock(Match match, CodeBlockType blockType, String text) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
Cause of Error:
This error occurs mainly if your .aspx page, html tags are not closed properly or you have Bad Html tags which could lead to Html Parser error.
Example: I was playing with FreeTextBox, in Html mode. Suddenly a Phone rangup and forget to close Html tag inside FreeTextbox.


<FTB:FreeTextBox ID="FreeTextBox1" runat="Server"
Width="700" Height="500" TabIndex="8" DisableIEBackButton="true">
<Toolbars>
<FTB:Toolbar>
<FTB:InsertHtmlMenu runat="server" Title="Insert Code">
<Items>
<FTB:ToolbarListItem Text="Student" Value="<img
src='<%= Page.ResolveUrl("
~")%&gt;Images/add_buddy.gif' />"
runat="server" />
</Items>
</FTB:InsertHtmlMenu>
</FTB:Toolbar>
</Toolbars>
</FTB:FreeTextBox>

Solution:
Remove Bad Html or rectify Bad Html part from your .aspx page and this error would get resolved.

No comments:

Most Recent Post

Community Updates

Subscribe Blog via Email

Enter your email address:



Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape