I use Asp.Net with the AjaxControlToolkit.
I like to add a calendarextender, so i tryed:
<b>Calendar with an associated button:</b><br />
<asp:TextBox runat="server" ID="Date5" />
<asp:ImageButton runat="Server" ID="Image1" ImageUrl="~/images/Calendar_scheduleHS.png" AlternateText="Click to show calendar" /><br />
<ajaxtoolkit:calendarextender ID="calendarButtonExtender" runat="server" TargetControlID="Date5"
PopupButtonID="Image1" />
<div style="font-size: 90%">
<em>(Click the image button to show the calendar; this calendar dismisses automatically
when you choose a date)</em></div>
The code is just put from the example.
No errors and it builds.
But after he runs it i'll get this error:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
But if i delete the code above, the error is gone.. so its something with the AjaxControlToolkit.
But what ?
I use Studio 2008, and the AjaxControlToolkit for .NET 3.5
What should i do/change?
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
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 301: link.Attributes.Add("type", "text/css");
Line 302: link.Attributes.Add("rel", "stylesheet");
Line 303: header.Controls.Add(link);
Line 304:
Line 305: // ASP.NET AJAX doesn't currently send a new head element down during an async postback, |
Source File: Z:\Software\Microsoft\AJAX .Net Toolkit\2008\AjaxControlToolkit-Framework3.5SP1\AjaxControlToolkit\ExtenderBase\ScriptObjectBuilder.cs Line: 303
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) +2108047
AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) in Z:\Software\Microsoft\AJAX .Net Toolkit\2008\AjaxControlToolkit-Framework3.5SP1\AjaxControlToolkit\ExtenderBase\ScriptObjectBuilder.cs:303
AjaxControlToolkit.ExtenderControlBase.OnLoad(EventArgs e) in Z:\Software\Microsoft\AJAX .Net Toolkit\2008\AjaxControlToolkit-Framework3.5SP1\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:307
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
|
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433