Full screen takeover of parent from iframe with javascript

December 16th, 2011

If you have an iframe with external content (aka poor mans integration) you might need to modify the size of the iframe dynamically. Security limitations on javascript can make this a little bit troublesome.

Here is a small how-to if you need to take over the screen from a link inside an iframe, as long as you’re using the same domain name on both the parent and the iframe page. The script below requires jQuery, but should be easy to rewrite if you use any other javascript framework.
Read the rest of this entry »

Create EPiServer page programmatically with PageTypeBuilder

September 29th, 2011

Here is just a few examples of how to create and modify pages in EPiServer CMS 5/6 when you are using PageTypeBuilder.
Read the rest of this entry »

Context menu missing in EPiServer CMS

May 2nd, 2011

If the right click context menu is missing in EPiServer CMS, the reason might not be obvious. First of all you should check if the context menu javascript is visible in the html source code, which should include something like this: var menu1 = new ContextMenu();

If the javascript of the context menu is visible, the problem could be:

  • There is a javascript error on your page. Debug your javascript and fix the problem, or begin by removing all of your javascript to see if the context menu appears.
  • You’re using a browser which doesn’t support it.

If you don’t see the javascript, the possible reason could be:

  • You don’t have sufficient rights to see the rightmenu. If this is the cause, you will most likely not be able to access edit mode by manually entering the address either.
  • It is disabled in admin mode, check setting by going to Admin -> Config tab -> Plug-in Manager -> EPiServer -> Overview tab -> Page Extensions section -> ContextMenu checkbox
  • You are missing the form tag in your page. Add <form runat=server>.
  • You are using an Enterprise version of EPiServer, and have a bad configuration in either episerver.config or EPiServerFramework.config.
    Check the siteHosts settings in both files; the language setting should not differ, nor should it be specified in only one of the config files. See correct example below.
    EpiServerFramework.config: <siteHosts siteId=”MySite”><add name=”mysite.local.com” language=”en” /></siteHosts>
    episerver.config: <siteHosts><add name=”mysite.local.com” language=”en” /></siteHosts>

Modal dialog window unable to send returnValue in Google Chrome

March 18th, 2011

Yesterday I noticed very odd behaviour in an editor interface using a javascript showModalDialog function.

After a lot of testing and pulling my hair, I came to the conclusion that it’s a bug in Google Chrome (tested in Chrome version 10) which cause the return value to be unreadable from the modal window, after a redirection of any kind (reload, post, etc) has occurred.

When the content of the modal window first loads, there’s no problem at all. After a post inside the window has been made, or for instance a change page link has been clicked, the connection to the parent window seems to be broken for ever and ever. The returnValue will be “undefined” until the window is closed and a new modal dialog has been opened.

I made a testpage to recreate this bug in Google Chrome, test it here:
modalDialogTest (opens in new tab/window)

AD connection denied after full search using membership provider

March 18th, 2011

If you have a custom membership provider connected to an Active Directory and a full user search is made in EPiServer admin mode, the AD can stop connecting with the user running the website.

The error generated is “Unknown error (0×80005000)” and the solution is to disable full searches for users in the custom membership provider.

If the AD has started to block the connections the IIS seems to need a restart (or at least the website need to restart) in order for the AD connection to start working properly again.

EPiServer custom property dropdown

February 18th, 2011

Some EPiServer developers still create their own custom property for the only purpose of having a simple dropdown (aka combobox / select list) for editors to choose from a predefined list.
If you only need a simple key/value dropdown, there’s no need to create a custom property – all you need is to configure it using appSettings in web.config.
Read the rest of this entry »

Control referenced by the ControlToValidate property cannot be validated

February 3rd, 2011

Form validation is common, but surprisingly, the ASP.NET built in validation controls don’t work with the CheckBox (or CheckBoxList) web controls!
If you specify the ControlToValidate attribute in a validator to the ID of a CheckBox (and ValidationGroup too) then you will receive the following exception:
Control [ID] referenced by the ControlToValidate property of [ID] cannot be validated.

Read the rest of this entry »

To var or not to var – c# implicit variable declaration

January 13th, 2011

There is always a lot of talk about coding conventions and best practices, and with C# 3.0 came implicitly typed local variables which enables the var keyword to be used when declaring variables. The variable will in fact be strongly typed. The compiler takes care of that by determining the appropriate type. The question is in which cases should we use var instead of the usual explicit declaration?

Read the rest of this entry »

Extensions for LinkItemCollection – Convert to pages and prepare Link Items for repeater

December 3rd, 2010

LinkItemCollection is a very useful property type in EPiServer. However, quite often you need to transform, convert or in some ways prepare a LinkItemCollection before you can use it the way you want to.

Read the rest of this entry »

Reasons why to upgrade EPiServer CMS

November 26th, 2010

Many have written articles about how you upgrade EPiServer 4.6 sites to CMS 5 but rarely why with reasons and benefits to do so. Even though EPiServer CMS 5 was released over three years ago, too many companies still use EPiServer 4.62 and some have even older versions. Why? Well, our customers need concrete arguments to motivate the cost, other than the usual “because it’s a new better version”. Worth noting is that it’s likely an increased risk the customer changes their publishing system entirely if they use an older version.

Therefore, I have put together a list of reasons (in no particular order) why companies should upgrade their EPiServer 4 websites to EPiServer CMS 5 (or preferably the newer version 6).

Read the rest of this entry »