Linus Ekström
Jan 18, 2013
  11813
(3 votes)

Resetting your EPiServer views

Note: This functionality was added to "My Settings->Display Options" in EPiServer 7.5.

In EPiServer 7 it’s possible to personalize your views quite extensively. Unfortenately, there is currently no easy way of resetting your views back to “system default”. I have created a simple self executing aspx file that clears add the personalized panels for your views (Currently this applies to the dashboard and new cms edit view). Place the code below in an empty file with an .aspx extension and browse to it to clear your settings:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.Page" %>
<%@ Import Namespace="EPiServer.Shell.ViewComposition" %>
<html>
<body>
    <form id="form1" runat="server">
    <div>
        Your view settings have been cleared.
    </div>
    </form>
</body>
</html>
<script runat="server">
 
        protected override void OnInit(System.EventArgs e)
        {
            var repository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IPersonalizedViewSettingsRepository>();
            var settings = repository.Load(User);
 
            foreach (PersonalizedViewSettings setting in settings)
            {
                foreach(IContainer component in setting.CustomizedContainers)
                {
                    // Uncomment to delete cookies. Note that you have to add the cookie path in the code below
                    //DeleteCookiesRecursive(component);
                }
                repository.Delete(User, setting.ViewName);
                Response.Write("Deleting custom settings for view: " + setting.ViewName);
            }
        }
 
        //protected void DeleteCookiesRecursive(IComponent component)
        //{
        //    var existingCookie = Request.Cookies[component.Id.ToString()];
        //    if (existingCookie != null)
        //    {
        //        var cookie = new HttpCookie(component.Id.ToString());
        //        cookie.Expires = DateTime.Now.AddDays(-1);
        //        //TODO: If you want to clear the cookies you need to specify the correct path
        //        //We are planning to use local storage instead of cookies in the future to remove this need.
        //        cookie.Path = "/[uipath]/cms/;
        //        Response.Cookies.Add(cookie);
        //        Response.Write("Deleting cookie with id: " + component.Id);
        //    }
 
        //    IContainer container = component as IContainer;
 
        //    if (container == null)
        //    {
        //        return;
        //    }
 
        //    foreach (IComponent subComponent in container.Components)
        //    {
        //        DeleteCookiesRecursive(subComponent);
        //    }
        //}
</script>

Clear cookies

When you change the size of the components (or gadgets if you like) inside a pane we currently store these settings inside a cookie. The code above has code to remove these cookies but the path needs to match the path of the cookie to be able to remove it. This seems to be quite dynamic to I have commented out this code by default. If you want to have this feature you can uncomment this code and just set the correct path value for your site, for instance “/myuipath/cms/”.

We are planning to use local storage in the browsers to remove the need to have cookies since this add size for each request.

Jan 18, 2013

Comments

Jan 24, 2013 09:32 AM

Solved my issue with an empty dashboard.

Just adding some keywords so it will easier to get this page in the search result.

Reset dashboard
Unable to insert child in GridContainer
TypeError
Clear Dashboard
Missing gadgets in dashboard

Jan 24, 2013 09:43 AM

I have added this feature to the "My Settings" screen for the next framework release of EPiServer.

Mar 11, 2013 10:07 PM

Thanks, this really helped cleaning up my test site!

Seth van der Maas
Seth van der Maas Mar 29, 2013 10:17 AM

Thanks.. started to get quite annoyed with my interface :)

Oct 21, 2013 02:56 PM

This post is from January. Is there anything like a reset button planned in an upcoming patch?

Oct 22, 2013 07:28 AM

As mentioned before, this will be part of the next release that is not that far away. We will not release any more UI-add-on upgrades before that.

Matti Mertojoki
Matti Mertojoki Nov 20, 2014 07:09 AM

We made .NET Framework update from 4.0 to 4.5 for EPiServer 7.0 (Patch 4) site because we had some annoying problems with IE11. Problems with IE11 were solved but some heavy users lost list of pages from page edit side! There were just empty grey area.
This Resetter-script solved problem. Thank you very much!

Please login to comment.
Latest blogs
I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog

Recraft's image generation with AI-Assistant for Optimizely

Recraft V3 model is outperforming all other models in the image generation space and we are happy to share: Recraft's new model is now available fo...

Luc Gosso (MVP) | Nov 8, 2024 | Syndicated blog

ExcludeDeleted(): Prevent Trashed Content from Appearing in Search Results

Introduction In Optimizely CMS, content that is moved to the trash can still appear in search results if it’s not explicitly excluded using the...

Ashish Rasal | Nov 7, 2024

CMS + CMP + Graph integration

We have just released a new package https://nuget.optimizely.com/package/?id=EPiServer.Cms.WelcomeIntegration.Graph which changes the way CMS fetch...

Bartosz Sekula | Nov 5, 2024

Block type selection doesn't work

Imagine you're trying to create a new block in a specific content area. You click the "Create" link, expecting to see a CMS modal with a list of...

Damian Smutek | Nov 4, 2024 | Syndicated blog

.NET 8 FAQ

I have previously written about .NET compatibility in general and .NET 8 in particular, see blog posts here , here and here . With the end of suppo...

Magnus Rahl | Nov 4, 2024