Hi there,
I'm trying to use RadlistBox with custom item template under RadAjaxPanel where my page is a webform which use a MasterPage file.
And I'm receiving the following error:
Server Error in '/' Application.
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:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +9812992
Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +142
[HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.]
Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +190
Telerik.Web.UI.RadAjaxControl.PerformRender() +405
Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1187
Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +75
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +270
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +14
System.Web.UI.Page.Render(HtmlTextWriter writer) +30
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +67
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +101
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +27
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1342
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.3752.0
How can I solved it? below is my asp.net webform declaration.
Looking forward to your earliest reply,
Thanks,
Hagai.
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanelPublications"
runat
=
"server"
>
<
telerik:RadListBox
ID
=
"RadListBoxPublications"
runat
=
"server"
AllowReorder
=
"True"
EnableDragAndDrop
=
"True"
SelectionMode
=
"Multiple"
Width
=
"98%"
Height
=
"700px"
>
<
ItemTemplate
>
<
div
class
=
"row"
>
<
div
class
=
"col-md-9"
>
<
div
dir
=
"<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Language == Idc.FacultySites.Models.Publication.LanguageName.Hebrew? "
rtl" : "ltr" %>"
class="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Language == Idc.FacultySites.Models.Publication.LanguageName.Hebrew? "text-right-fix" : "text-left-fix" %>">
<
a
id
=
"PublicationLink"
runat
=
"server"
>
<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Text %>
</
a
>
</
div
>
</
div
>
<
div
class
=
"col-md-1"
> </
div
>
<
div
class
=
"col-md-2"
>
<
div
class
=
"row"
>
<
div
class
=
"col-md-2"
>
<
telerik:RadButton
ID
=
"RadButtonEditPublication"
runat
=
"server"
RenderMode
=
"Lightweight"
ToolTip="<%$ Resources:FacultySites, Edit%>" CommandArgument="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Id %>" OnCommand="RadButtonEditPublication_Command">
<
ContentTemplate
>
<
span
class
=
"glyphicon glyphicon-edit"
></
span
>
</
ContentTemplate
>
</
telerik:RadButton
>
</
div
>
<
div
class
=
"col-md-2"
>
<
telerik:RadButton
ID
=
"RadButtonDeletePublication"
runat
=
"server"
RenderMode
=
"Lightweight"
ToolTip="<%$ Resources:FacultySites, Delete%>" OnClick="RadButtonDeletePublication_Click" CommandArgument="<%# (DataBinder.GetDataItem(Container) as Idc.FacultySites.Models.Publication).Id %>" OnCommand="RadButtonDeletePublication_Command">
<
ContentTemplate
>
<
span
class
=
"glyphicon glyphicon-remove"
></
span
>
</
ContentTemplate
>
<
ConfirmSettings
ConfirmText="<%$ Resources:FacultySites, GeneralActionConfirmMessage%>" />
</
telerik:RadButton
>
</
div
>
<
div
class
=
"col-md-8"
> </
div
>
</
div
>
</
div
>
</
div
>
<
div
class
=
"row"
>
<
div
class
=
"col-md-12"
> </
div
>
</
div
>
</
ItemTemplate
>
</
telerik:RadListBox
>
</
telerik:RadAjaxPanel
>