Skip to content
1 min read

What Happened to my "Add New" Button? XSLTListViewWebPart Error.

Recently I had been working on a SharePoint Hosted App with custom lists created in Visual Studio. On one of my application pages I had a need for an XSLTListViewWebPart and found out the web part was missing the "Add New" button! So where'd it go?


In SharePoint you can control the showing/hiding of this toolbar by changing the Toolbar Type to "Summary". So immediately I tried to find the ToolbarType attribute using Intellisense, but it was no where to be found! I then continued to search through the properties window in Visual Studio and the same luck continued. 

After much searching through my solution, I had found the culprit. When using an XSLTListWebPart the view is determined by the default view on the list. What I didn't know was that the ToolbarType is also determined by that view! So I opened up my list schema.xml in Visual Studio and saw this.

Standard

By default the view, when created in Visual Studio, will have a toolbar of "Standard". Unfortunately I was hoping for the "Summary" toolbar. In order to have the "Summary" toolbar, we need to choose the toolbar type of "Freeform". See below.

Freeform


By changing the Toolbar type to "Freeform" the Add New button will show up on the bottom of your XSLTListViewPart!

Be aware: You are going to run into problems if you are trying to use the "Add New" button when loading an XSLTListViewWebPart in a Client App Part or within an IFrame. You will most likely run into the annoying "Display forbidden X-Frame-Options" error message which will prevent the window from loading external pages.

Share
  
DON'T MISS!

Expert Insights from the Aerie Team

Drop us a line

Our team will be happy to answer your questions.

ADDRESS: 110 West Canal Street, Suite 201
Winooski, VT 05404

PHONE
: (813) 358-4656
HOURS: 8:00 am - 5:00 pm EST Monday to Friday
EMAIL: chanson@aerieconsulting.com