Google Android Development Agency SASS
Showing posts with label umbraco. Show all posts
Showing posts with label umbraco. Show all posts

Thursday, 21 May 2009

Editing Umbraco in canvas mode gives error

I hit a slight quirk with Umbraco today. One of the features of Umbraco is its ability to edit a page in "Canvas mode". This means your page opens in a new window and is rendered as if it was a website, but with a content editor for you to edit your content in; much nicer than using that small white editor.

Today I fired up the canvas editor for one of the pages in a new site I'm working on, only to be met with:

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Hmmf. It's because in the footer of the website I'm doing:

<%=DateTime.Now.Year%>

To output the current year. Umbraco is attempting to modify the controls collection of the page to create the editor, which is not allowed when using inline code blocks.

The workaround is a bit sneaky, but simple. All you need to do is change to the databinding syntax for echoing, like this:

<%# DateTime.Now.Year %>

Now all is well, the control collection can be modified and you can bask in the glory of the Umbraco canvas editor.

Thursday, 30 April 2009

Showing the debug trace in Umbraco

Whilst developing with Umbraco, you'll quite often come across errors in UserControls where all you'll see is a big red box with not a lot of info as to what the error is and where it occurred.

It's easy to find this info when you know how; just add umbdebugshowtrace=true to your querystring and you'll see the debug stack trace, allowing you to locate the problem.