Kentico 10 custom web part fails to load on the design tab only

Patrick Taylor asked on October 23, 2018 22:07

Has anyone here run into an issue with Kentico 10 where custom web parts display a load error on the Design tab but render fine on the page tab? I'm also seeing the same web part fail to load altogether when used as a widget on the page tab.

I'm using a reduced test case in a default Kentico 10 install.

Design tab

Page tab

Correct Answer

Patrick Taylor answered on October 24, 2018 15:07

Alex Golebiewski and Brenden Kehren helped me figure out that this error was caused by my use of the <%= %> syntax in my ascx layout. You can resolve the issue by substituting that syntax for an asp:literal or using some other technique such as manipulating the DOM with JS and hidden fields. The event log reported Message: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

0 votesVote for this answer Unmark Correct answer

Recent Answers

Peter Mogilnitski answered on October 24, 2018 03:08

what is the error in the event log? Did you follow the documentation?

0 votesVote for this answer Mark as a Correct answer

Dragoljub Ilic answered on October 24, 2018 12:39

Hi Patrick,

This issue usually occurs when you use some data in your web part which is not accessible currently on design. It could be some query string, cookie, maybe some config or other data that is not accessible though design tab. Like Peter mention above, you should look first into event log.

Also, how your .ascx template looks like?

Best regards, Dragoljub

0 votesVote for this answer Mark as a Correct answer

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