Custom Forms Showing in View Selector

If you’ve ever created custom forms in a SharePoint list’s context, for example:

  • [SiteName]/Lists/[ListName]/MyForm.aspx for a list, or
  • [SiteName]/[DocumentLibrary]/Forms/MyForm.aspx for a Document Library

you may have found that your form shows up in the list’s view selector at the upper right of the list pages.

image

If this happens, you may have done what I’ve done many times, which is to copy one of the view pages (such as AllItems.aspx) to start your custom form, rather than copying one of the existing forms.

You can see what I mean by doing some simple testing.  First, create a list or library that you can delete later.  Next, open the site in SharePoint Designer, navigate to the list, and make a copy of Allitems.aspx.

image

Go back to your browser, refresh, and you’ll see All Items listed twice in the view selector.

New Picture

Now do the same thing, except this time make a copy of one of the form pages (NewForm.aspx, EditForm.aspx, DispForm.aspx, etc.).

image

Go back to the browser and refresh, and no additional view shows up in the view selector.

Interestingly enough, even if you copy all of the code from the AllItems.aspx page into your DispForm_copy(1).aspx page above, the page doesn’t show up in the view selector.  There must be some difference in the way the view pages and the form pages are registered to begin with in the database, but it’s nothing that I can find in the page code itself.

When it comes right down to it, it doesn’t matter which type of page you copy to start with, but make sure that you fully remove the WebPartPages:ListViewWebPart if you start with a view page, and you won’t see your new page showing up in the view selector.

Similar Posts

5 Comments

  1. I didn’t get why you was surprised. When u copy AllItems.aspx , Sharepoint designer does 2 things, it copies the page and also make an entry in database for the view , and that’s why you see it in View Selector.. For DisForm it does make the copy and nothing else.

    That’s the default behaviour

    1. Not surprise, really, just a gotcha that I’ve run into and I’ve seen others run into as well. No need for others to make the same mistake!

      M.

  2. Marc! I have looked for this for weeks, but I have the same issue with extra views. However, I do not remember copying a view to make a form. Also, I get extra views in one list when I copy and paste forms in a completely different list! So strange and I can’t delete the extra view even as a Site Collection Admin! And Designer when opening the custom form decides to duplicate webparts with the same GUID and if I don’t catch it before I save it, then that page will no longer open! Looks like I have to rebuild some lists! :(

    1. Looks like the view was created by actually adding a DVWP to a page that points to a different list. No clue as to why it does this. I had created a new page and tested that an extra view was not created and it wasn’t. I added several other webparts to the new page and still the extra view was not created. I added a DataFormWebPart to the page that points to a different list and the extra view gets created in that list! So strange!

  3. After a few hours of making bad decisions, I found that deleting the DisplayName value removes it from the View Selector. You will need to do a find for each of the view titles and remove the value leaving “”. Hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.