<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><language>en</language><title>Blog posts by Kalle Hoppe</title> <link>https://world.optimizely.com/blogs/Kalle-Hoppe/</link><description></description><ttl>60</ttl><generator>Optimizely World</generator><item> <title>Is page in Edit mode</title>            <link>http://www.ninjacoding.net/archive/2009/08/31/is-page-in-edit-mode.aspx</link>            <description>&lt;p&gt;I’m writing an account registering control. This control needs to show the user how to register for a new account. But when modifying this control the pages editors must be able to see the hole flow. So I went looking for a smart way to display the control in two ways depending on the context it’s being viewed in. I found &lt;a href=&quot;http://labs.episerver.com/en/Blogs/Jacob-Khan/Dates/2009/8/Am-I-in-Edit-or-View-mode/&quot;&gt;Jacob Khan’s&lt;/a&gt; blog post in &lt;a href=&quot;http://labs.episerver.com/en/Blogs/&quot;&gt;EPiServer labs&lt;/a&gt; that seemed nice but I didn’t get it to work.&lt;/p&gt;  &lt;p&gt;The thing I ended doing was to get the id from the query string, and parsing it to a PageReference to check if it contains a workID. The ID in the QueryString has both the pages ID and the current version being edited, for example 1563_1234 where 1563 is the pages ID and 1234 is the current version. &lt;/p&gt;  &lt;p&gt;If the QueryString contains a work page ID it means that I&#39;m currently looking at a draft, not the published page, hence I&#180;m in Edit mode. &lt;/p&gt;  &lt;p&gt;When getting the WorkID of a PageData object that&#39;s published you will get 0 as a result, and that&#39;s what I&#39;m testing against. &lt;/p&gt;  &lt;p&gt;Here is the code    &lt;br /&gt;&lt;/p&gt;  &lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;public bool IsPageInEditMode
{
    get
    {
        PageReference pageVersionReference = PageReference.Parse(Request.QueryString[&quot;id&quot;]);
        if (pageVersionReference.WorkID &amp;gt; 0)
            return true;
        return false;
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:88ccf082-6d87-421f-a893-0af4774a7302&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Technorati-taggar: &lt;a href=&quot;http://technorati.com/tags/.net+development&quot; rel=&quot;tag&quot;&gt;.net development&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/EPiServer&quot; rel=&quot;tag&quot;&gt;EPiServer&lt;/a&gt;&lt;/div&gt;&lt;img src=&quot;http://www.ninjacoding.net/aggbug/53.aspx&quot; width=&quot;1&quot; height=&quot;1&quot; /&gt;</description>            <guid>http://www.ninjacoding.net/archive/2009/08/31/is-page-in-edit-mode.aspx</guid>            <pubDate>Mon, 31 Aug 2009 14:40:54 GMT</pubDate>           <category>Blog post</category></item></channel>
</rss>