0

I need to add experience editor condition in the Sitecore aspx layout file. I tried adding this

<%if(Sitecore.Context.PageMode.IsExperienceEditor){%>
                                                <span>
                                                    <sc:Placeholder Key="standard-footer" runat="server" />
                                                </span><% } 
                                                    else {%>
<a href="www.abc.com">
                                                    <sc:Placeholder Key="standard-footer" runat="server" />
                                                </a><% } %>

but with that i am getting The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>) error.

Any way of adding experience editor condition in aspx layout file.

4
  • can you try to add the runat="server" attribute to the <span> and <a> tag? Aug 3 '21 at 7:12
  • And put the condition just around the link (as that is the only difference)
    – Gatogordo
    Aug 3 '21 at 7:14
  • still getting the same issue The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
    – Kevin
    Aug 3 '21 at 7:30
  • Welcome to Sitecore StackExchange. Could you add what other controls you have defined on the page? The code block by itself is running without errors, but the error can be caused if you have dynamic controls added on the page. Aug 3 '21 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.