Error after adding
I just tried putting some layout boxes into a template and got the following error page. I can no longer edit the page or navigate to it normally. I'm presenting with the following error screen every time.
Server Error in '/sitefinity4' Application.
Placeholders of adjacent controls do not match.
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.IO.InvalidDataException: Placeholders of adjacent controls do not match.
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:
[InvalidDataException: Placeholders of adjacent controls do not match.]
Telerik.Sitefinity.Modules.Pages.PageHelper.SortControls(IEnumerable`1 controlContainers, Int32 count) +670
Telerik.Sitefinity.Modules.Pages.PageHelper.ProcessControls(IList`1 builders, IList`1 controlContainers) +69
Telerik.Sitefinity.Modules.Pages.StaticPageData..ctor(PageData pageData, PageDataProvider provider) +272
Telerik.Sitefinity.Web.PageRouteHandler.GetPageData(SiteMapNode node) +342
Telerik.Sitefinity.Web.RouteHandler.GetHttpHandler(RequestContext requestContext) +75
System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +106
Telerik.Sitefinity.Web.SitefinityHttpModuleIIS6.PostResolveRequestCache(HttpContextBase context) +402
System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +80
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3614
Hi Chris,
The error is produced, because of mismatch of the controls/holders in the template and their parent ids. The error is thrown when the parent of one control/holder do not match correct child and docks cannot be arranged properly. We tried to reproduce this on a single template several times with no avail. Could you give us some steps( or send a screencast) that we could follow to replicate the issue here.
All the best,
Ivan Dimitrov
the Telerik team
Ivan,
Did you ever resolve this as I am now getting the same error?
Thanks,
Garry
Hi Chris,
We have not succeeded replicating the issue. There were other problems prior SP1, but they are fixed.
Greetings,
Ivan Dimitrov
the Telerik team
Ivan,
I am running on SP1 and how I ended up getting this error was by commenting out certain div/contentplaceholders because I was unable to select the search box on the template to set its search location. Once I commented out the sections that were overlapping they disappeared as I wanted, but when I uncommented them the controls in those sections no longer appeared and once I added a control back to the section I got this error.
Any idea on how I can clear this out or at least clear the DB so I can atleast resetup my template?
Thanks,
Garry
My Template
<%@ Master Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
<
title
></
title
>
<
meta
http-equiv
=
"content-type"
content
=
"text/html; charset=utf-8"
/>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
></
asp:ScriptManager
>
<
div
id
=
"wrapper"
>
<
div
id
=
"header"
>
<
asp:HyperLink
ID
=
"HyperLink1"
runat
=
"server"
NavigateUrl
=
"~/Default"
Target
=
"_self"
>
<
div
id
=
"logo"
>
</
div
>
</
asp:HyperLink
>
<
div
id
=
"navigation"
>
<
asp:contentplaceholder
id
=
"Navigation"
runat
=
"server"
/>
</
div
>
<
div
id
=
"search"
>
<
asp:contentplaceholder
id
=
"Search"
runat
=
"server"
/>
</
div
>
<
div
id
=
"login"
>
<
asp:ContentPlaceHolder
ID
=
"Login"
runat
=
"server"
/>
</
div
>
<
div
id
=
"static"
>
<
asp:ContentPlaceHolder
ID
=
"Static"
runat
=
"server"
/>
</
div
>
<%--<
div
class
=
"header-image-tooltip"
>
<
div
class
=
"header-image-tooltip-title"
>
Explore your potentials
</
div
>
<
div
class
=
"header-image-tooltip-text"
>
Share your voice and unlock your potentials while we will equip you with the skills you need for the future!
</
div
>
</
div
>--%>
</
div
>
<%--<
div
id
=
"header-image"
>
<
div
id
=
"image-placeholder"
>
<
asp:contentplaceholder
id
=
"ImagePlaceholder"
runat
=
"server"
/>
</
div
>
</
div
>--%>
<
div
id
=
"main"
>
<
div
class
=
"content"
>
<
asp:contentplaceholder
id
=
"Main"
runat
=
"server"
/>
</
div
>
</
div
>
<
div
id
=
"footer"
>
<
asp:contentplaceholder
id
=
"Footer"
runat
=
"server"
/>
</
div
>
</
div
>
</
form
>
</
body
>
</
html
>
Server Error in '/' Application.
--------------------------------------------------------------------------------
Placeholders of adjacent controls do not match.
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.IO.InvalidDataException: Placeholders of adjacent controls do not match.
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:
[InvalidDataException: Placeholders of adjacent controls do not match.]
Telerik.Sitefinity.Modules.Pages.PageHelper.SortControls(IEnumerable`1 controlContainers, Int32 count) +692
Telerik.Sitefinity.Modules.Pages.PageHelper.ProcessControls(IList`1 builders, IList`1 controlContainers) +98
Telerik.Sitefinity.Modules.Pages.StaticPageData..ctor(PageData pageData, PageDataProvider provider) +522
Telerik.Sitefinity.Web.PageRouteHandler.GetPageData(SiteMapNode node) +626
Telerik.Sitefinity.Web.RouteHandler.GetHttpHandler(RequestContext requestContext) +132
System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +11340424
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +266
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Hi Chris,
Insight on how things work:
In Sitefinity, every widget remembers its previous widget. This is how widgets are rendered the same way you ordered them in the backend. The problem you describe happens when two consequent widgets have different placeholders. This should not happen and is handled by Sitefinity when you move widgets from the Page Editor. When you hid those sections, they stopped being handled by Sitefinity. When you uncommented them again, they are handled again and suddenly there is an error in the validation I mentioned.
What you can do:
You can write some code that will loop through the controls of the template which is broken and fix it. The widgets on the template are stored as TemplateControl objects. They have a Placeholder property which is the name of the placeholder of the control and a SiblingId property, which specifies the Id of the control before the current. You should be able to write some logic that will fix the problem, now that you know what it is. Here is the exact code that throws the exception:
var previousControl = nodes.FirstOrDefault(c => c.Id == ctrl.SiblingId);
if
(par !=
null
)
if
(!previousControl.PlaceHolder.Equals(ctrl.PlaceHolder, StringComparison.OrdinalIgnoreCase))
throw
new
InvalidDataException(Res.Get<PageResources>().AdjacentControlPlaceholdersDoNotMatch);
You can also try to search through the database and edit controls manually. This is not very straightforward since the relations in the database are hard to follow. The tables you need to look at are:
sf_object_data - contains one row for each control. Each control knows the template/page it resides in.
sf_control_property - contains the properties for all controls. Each property knows the widget it is for.
You must look for SiblingId property. You can set all SiblingIds to Guid.Empty. This should make the page render without error but you will lose the ordering of the controls. You will have to reorder them manually.
I'm getting this now too.
The page was using a custom template but the nav bar was on the bottom of the page when it was published.
We made a new template bases on Left Sidebar.
After we changed the template the page started to throw this error.
UPDATE
Trying to open the template causes this error now too.
This is just like the Cyclic Child Error we got that forced us to totally recreate the entire project.
Hello Chris,
You should be able to fix the template with the 4.1 SP1 release. It will be out this week.