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.
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.
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