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.