1

I have the following XsltListViewWebPart on a custom application page:

<WebPartPages:XsltListViewWebPart runat="server"
    Title="My Documents"
    ListUrl="Lists/MyDocuments"
    ViewGuid="{00000000-0000-0000-0000-000000000000}"
    ChromeType="TitleOnly"
    ShowToolbarWithRibbon="FALSE"
    >
    <XmlDefinition>
       <View MobileView="TRUE" Type="HTML" Level="1">
           <Query>
                <Where>
                    <Eq>
                        <FieldRef Name='MyDocMyId'/>
                        <Value Type='Text'>{controlMyID}</Value>
                    </Eq>
                </Where>
            </Query>
           <ViewFields>
               <FieldRef Name="DocIcon"/>
               <FieldRef Name="Title"/>
               <FieldRef Name="MyDocType"/>
               <FieldRef Name="MyDocDate"/>
               <FieldRef Name="MyDocNotes"/>
           </ViewFields>
           <RowLimit Paged="TRUE">30</RowLimit>
           <Toolbar Type="FreeForm"/>
       </View>
    </XmlDefinition>
    <parameterbindings>
       <!-- ootb bindings snipped -->
       <ParameterBinding Name="controlMyID" Location="Control(myDocMyId,Value)" DefaultValue="0" />
    </parameterbindings>
</WebPartPages:XsltListViewWebPart>

It's working great, except it is rendering with the New/Upload/Actions/Settings/View toolbar. If I remove the ViewGuid attribute, the toolbar goes away, but the web part renders using 2007-ish table-based HTML.

Is there a way to configure a XsltListViewWebPart using a custom view so that it has the same XSLT look and feel, but does not show the toolbar?

2 Answers 2

1

You can think of using Permissions to hide the toolbar. I guess the toolbar is displayed only if the role has "Full Control" and/or "Design". I assume most of your site users will not have these permissions? Removing them should get rid of the toolbar!

0

Change the <Toolbar Type="FreeForm"/> to <Toolbar Type="None"/>

3
  • No change. And, according to MSDN, the only values are Standard and FreeForm. Mar 12, 2012 at 15:57
  • try removing the toolbar attribute entirely. Mar 12, 2012 at 16:10
  • No difference there either. My first version didn't have the Toolbar element or the ShowToolbarWithRibbon attribute. Adding them didn't change anything, but I included them in my question for completeness. Mar 12, 2012 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.