Home

Edit page link

By Johan Pettersson 24 November 2009 20:13

If you’re like me and don’t like the on-page-edit-right-click-menu but still want provide a simple shortcut for editors to edit the current page.

Our markup...

<a href="<%= CurrentPage.EditURL() %>">Edit this page</a>

... and our extension method

public static string EditURL(this PageData page)
{
    string baselink = UriSupport.AbsoluteUrlFromUIBySettings("edit/");

    return string.Format(
        "{0}SwitchLanguage.aspx?language={1}&epUrl={2}",
        baselink,
        page.LanguageBranch,
        HttpUtility.UrlEncode(string.Concat(baselink, "default.aspx?id=", page.PageLink.ToString())));
}

Of course you have check access rights before rendering the link.

Some useful extension methods

By Johan Pettersson 23 November 2009 20:42

Sometimes you don't want to use dynamic properties but still needs to find a certain page with a property or a page with a specific pagetype id.

Here's my take on it.

Read more...

Browse by

Tags

Dates

2010
August (1)
April (2)
January (2)
2009
December (4)
November (2)
October (1)