Blog posts by Emil Åström2016-08-31T22:11:39.0000000Z/blogs/emil-astrom/Optimizely WorldTranslation i EPiServerhttp://www.meadow.se/wordpress/?p=1842016-08-31T22:11:39.0000000ZThis applies to EPiServer 4.62, haven’t checked CMS 5 yet… To add translations in EPi, create a new translation file (or use an existings one) in the lang directory of the web root. Give it a name ending with the language code, e.g. “textsSV.xml”: string s = Global.EPLang.Translate(“/labels/hello”)   Translate standard controls:   Tip: Use <a class="more-link" href="http://www.meadow.se/wordpress/translation-i-episerver/">Read More ...</a>Unit testing an EPiServer ContentAreahttp://www.meadow.se/wordpress/?p=11822015-05-30T23:45:57.0000000ZBackground Consider the following simple method that returns the names of the items of a content area: The method is made up to be as simple as possible to illustrate the how unit testing against a ContentArea can be done, which turns out to be non-trivial. You might often have more complex logic that really <a class="more-link" href="http://www.meadow.se/wordpress/unit-testing-an-episerver-contentarea/">Read More ...</a>Get the Url to the EPiServer start page incl. language branchhttp://www.meadow.se/wordpress/?p=702007-07-10T10:14:05.0000000ZThis is how to retrieve the address to the startpage including the currently active language branch (e.g. “/sv/” or “/en/”): This code looks simple but it actually took me an hour or so to get it right (I haven’t worked with globalization before) so I thought it’d make a good blog post… /EmilDatabinding with a Repeaterhttp://www.meadow.se/wordpress/?p=692007-05-30T17:00:50.0000000ZThis is simple stuff, but I wanted to store these code snippets somewhere for easy re-use… This is how to do databinding with a Repeater control in ASP.NET. In the ASPX file: In the code-behind file: In Page_Load(), we connect the repeater to a datasource (in this case a collection of pages from EPiServer). GetTitle() <a class="more-link" href="http://www.meadow.se/wordpress/databinding-with-a-repeater/">Read More ...</a>How to detect if an EPiServer page is presented in DOPE modehttp://www.meadow.se/wordpress/?p=672007-05-15T18:27:30.0000000ZIn some cases it may be useful to detect when an EPiServer page is displayed in DOPE (Direct On-Page Editing) mode rather than the “normal” View mode. This is how to do it: This is the only way I have found to do this, but it feels like there should be a DOPE flag somewhere <a class="more-link" href="http://www.meadow.se/wordpress/how-to-detect-if-an-episerver-page-is-presented-in-dope-mode/">Read More ...</a>Resizing the Action Window panel in an EPiServer pluginhttp://www.meadow.se/wordpress/?p=662007-05-15T18:22:36.0000000ZHave you ever written en EPiServer plugin for the Action Window? If so, you have probably noticed how irritatingly narrow it is. Luckily, the width can easily be adjusted by your plugin using this code: This is the same code that the built-in EPiServer File Manager uses, so I think we can regard it as <a class="more-link" href="http://www.meadow.se/wordpress/resizing-the-action-window-panel-in-an-episerver-plugin/">Read More ...</a>How to refer to an EPiServer pagehttp://www.meadow.se/wordpress/?p=642007-04-08T15:50:24.0000000ZOften you have to refer to a given page in a site. For example, on each page you may want to have a footer with a link to a page that describes the site’s usage of cookies. Note that this is different than linking to pages in the navigation menus since those links are created <a class="more-link" href="http://www.meadow.se/wordpress/how-to-refer-to-an-episerver-page/">Read More ...</a>Using Web User Controls for EPiServer custom page property typeshttp://www.meadow.se/wordpress/?p=632007-02-25T17:19:37.0000000ZAll content in EPiServer pages are stored in page properties which can be of different types such as short string, XHTML string, date, etc. It is also possible tocreate custom property data types, which can be very useful in many circumstances such as when integrating with other systems or creating content which is not easily <a class="more-link" href="http://www.meadow.se/wordpress/using-web-user-controls-for-episerver-custom-page-property-types/">Read More ...</a>Why do I get “Registry access not allowed” error message?http://www.meadow.se/wordpress/?p=592007-02-13T15:04:06.0000000ZStruggling with this error that occurs the first time the site is viewed after an IIS restart? This problem can be caused by the EPiServer Scheduler service not being installed. Try this: (From the EPiServer FAQ: http://www.episerver.com/en/EPiServer_Knowledge_Center/Support/FAQ_EPiServer_4/905/923/)Retrieve the Html code for a Web User Controlhttp://www.meadow.se/wordpress/?p=582007-01-26T13:37:02.0000000ZHere’s how to extract the Html code for a web control: Tip: If you’re having problems with the generated Html being incomplete, then maybe you’re calling the function above in the wrong time? I’ve been having some problems with databound EPiServer controls until we discovered that we were doing this too early. When we started <a class="more-link" href="http://www.meadow.se/wordpress/retreive-html-code-for-a-web-user-control/">Read More ...</a>Open an EPiServer pagehttp://www.meadow.se/wordpress/?p=562007-01-24T10:07:46.0000000ZHere are a few ways to retrieve data for a given page (expressed in a PageReference instance) in EPiServer: Global.EPDataFactory also has some other useful functions: BTW, it’s also possible to initialize a PageReference with a Url (although NOT a Friendly Url): UPDATE (2007-06-04): If you have a so called “simple address” such as “/foo”, <a class="more-link" href="http://www.meadow.se/wordpress/open-an-episerver-page/">Read More ...</a>Get URL from an EPiServer PageReferencehttp://www.meadow.se/wordpress/?p=552007-01-18T14:38:05.0000000ZRetrieving the URL to an EPiServer page seems like a basic thing to do, but it’s not quite obvious… Referring to a page is normally represented by an instance of the PageReference class, so obviously that contains a public property called Url or something, right? Wrong! Instead, this is how to do it (as a <a class="more-link" href="http://www.meadow.se/wordpress/get-url-from-an-episerver-pagereference/">Read More ...</a>Pages without page types in EPiServerhttp://www.meadow.se/wordpress/?p=542007-01-17T11:46:11.0000000ZWhen creating “normal” ASPX pages (i.e. pages that are not EPiServer page types) to use in EPiServer sites it can be very useful to have them inherit from TemplatePage or SimplePage (both are EPiServer types) so that dynamic properties can be read, page methods called, etc. Unfortunately this will give rise to an error message <a class="more-link" href="http://www.meadow.se/wordpress/54/">Read More ...</a>User Controls in EPiServerhttp://www.meadow.se/wordpress/?p=532007-01-15T15:19:30.0000000ZThis is my first post about EPiServer, which basically is a framework for building web sites. It’s very capable and extensible and is in wide use in Scandinavia. For more information, look here: http://www.episerver.com. Web User Controls in EPiServer solutions should always inherit from EPiServer.UserControlBase rather than the usual System.Web.UI.UserControl. This gives access to useful <a class="more-link" href="http://www.meadow.se/wordpress/user-controls-in-episerver/">Read More ...</a>