Custom Page Type Widget issue

andrew c asked on February 4, 2015 12:56

Hi,

ive created a custom page type that has several long text fields. These page types are displayed in a repeater with the following transformation, which changes the style of the first item to make it "featured".

    <% 
        if (DataItemIndex ==0)
        {
    %>
        show a featured item
    <%
        }
        else
        {
    %>  
        show a regular item
    <%
        }
    %>
    <%
if (!string.IsNullOrEmpty(Eval("EventDate").ToString()) && !string.IsNullOrEmpty(Eval("EventLocation").ToString()))
       {
    %>
        format dates one way
    <%
        }
        else
        {
    %>  
        format dates another way
    <%
        }
    %>

When a user adds a widget to one of these text fields the page bombs out with the error "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." Is there any way to get over this error?

Recent Answers


andrew c answered on February 5, 2015 12:13

scratch that, got around it be specifying a first item transformation instead

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.