custom toolbar for sharepoint list

1.1k views Asked by At

I try to implement custom viewtoolbar for list template. I create customdefaulttemplate.ascx file under /TEMPLATES/CONTROLTEMPLATES. Code in customdefaulttemplate.ascx:

<....>
<%@ Register TagPrefix="CustomSurvey" Assembly="HideRespondToSurvey, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d6553d11ff33f7e" Namespace="HideRespondToSurvey.code"%>
<SharePoint:RenderingTemplate ID="CustomViewToolBar" runat="server">
    <Template>
        <wssuc:ToolBar CssClass="ms-menutoolbar" EnableViewState="false" id="toolBarTbl" ButtonSeparator="<img src='/_layouts/images/blank.gif' alt='' />" RightButtonSeparator="&#160;&#160;&#160;" runat="server">
            <Template_Buttons>
                <CustomSurvey:SurveyMenu runat="server"></CustomSurvey:SurveyMenu>
            </Template_Buttons>
            <Template_RightButtons>
                  <SharePoint:PagingButton runat="server"/>
                  <SharePoint:ListViewSelector runat="server"/>
            </Template_RightButtons>
        </wssuc:ToolBar>
    </Template>
</SharePoint:RenderingTemplate>

I create class SurveyMenu that inherit from Microsoft.SharePoint.WebControls.NewMenu and in CreateChildControls() I placed my logic. In list schema template under "View" I set ToolBarTemplate="CustomViewToolBar". My list is the survey list, but it has addition fields and event receivers logic. It has unique type in ListTemplate definition. I deploy list using feature, create list instance on the site but my toolbar isn't appear. I create this toolbar using methods described here and here, but it doesn't work.

May be you can take some useful resources about this topic, or make assumption why it may not to work. Thanks.

1

There are 1 answers

0
Scott Root On

Have you looked into possibly creating custom actions on the UI Ribbon? I have done it for a few things and you can make it just apply to all lists, some lists that you specify, and you don't have to go through the pain of creating and placing web parts on pages.