When I add the following line of code in my .aspx file
<% Response.Write(Session("copyrightDate"))%>
I get the following error when I try to run it
Is there a fix for this?
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Source Error:
Line 106: Dim panel As Panel = New Panel()
Line 107: panel.Controls.Add(_viewState)
Line 108: Page.Form.Controls.Add(panel)
Line 109: Dim script As String = ("document.getElementById('" _
Line 110: + (_viewState.ClientID + ("').value = GetViewState__AspNetTreeView('" _
Source File: C:\Documents and Settings\Brian Jones\My Documents\Visual Studio 2005\cis281\App_Code\Adapters\TreeViewAdapter.vb Line: 108
Stack Trace:
[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
System.Web.UI.ControlCollection.Add(Control child) +233
CSSFriendly.TreeViewAdapter.SaveAdapterViewState() in C:\Documents and Settings\Brian Jones\My Documents\Visual Studio 2005\cis281\IdeaSystems\App_Code\Adapters\TreeViewAdapter.vb:108
System.Web.UI.Control.SaveViewStateRecursive() +67
System.Web.UI.Control.SaveViewStateRecursive() +194
System.Web.UI.Control.SaveViewStateRecursive() +194
System.Web.UI.Control.SaveViewStateRecursive() +194
System.Web.UI.Page.SaveAllState() +595
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6647
-bdot
"There are only 10 kinds of people in this world. Those who understand binary and those who don't"
bdotjones
Member
240 Points
77 Posts
Controls collection Error
Oct 26, 2006 08:26 AM|LINK
When I add the following line of code in my .aspx file
<% Response.Write(Session("copyrightDate"))%>
I get the following error when I try to run it
Is there a fix for this?
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). Source Error: Line 106: Dim panel As Panel = New Panel() Line 107: panel.Controls.Add(_viewState) Line 108: Page.Form.Controls.Add(panel) Line 109: Dim script As String = ("document.getElementById('" _ Line 110: + (_viewState.ClientID + ("').value = GetViewState__AspNetTreeView('" _ Source File: C:\Documents and Settings\Brian Jones\My Documents\Visual Studio 2005\cis281\App_Code\Adapters\TreeViewAdapter.vb Line: 108 Stack Trace: [HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).] System.Web.UI.ControlCollection.Add(Control child) +233 CSSFriendly.TreeViewAdapter.SaveAdapterViewState() in C:\Documents and Settings\Brian Jones\My Documents\Visual Studio 2005\cis281\IdeaSystems\App_Code\Adapters\TreeViewAdapter.vb:108 System.Web.UI.Control.SaveViewStateRecursive() +67 System.Web.UI.Control.SaveViewStateRecursive() +194 System.Web.UI.Control.SaveViewStateRecursive() +194 System.Web.UI.Control.SaveViewStateRecursive() +194 System.Web.UI.Page.SaveAllState() +595 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6647"There are only 10 kinds of people in this world. Those who understand binary and those who don't"