共享点列表的自定义工具栏
我尝试为列表模板实现自定义视图工具栏。我在 /TEMPLATES/CONTROLTEMPLATES 下创建 customdefaulttemplate.ascx 文件。 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="   " 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>
我创建了从 Microsoft.SharePoint.WebControls.NewMenu 继承的类 SurveyMenu,并在 CreateChildControls() 中放置了我的逻辑。在“视图”下的列表架构模板中,我设置 ToolBarTemplate="CustomViewToolBar"。我的列表是调查列表,但它具有附加字段和事件接收器逻辑。它在 ListTemplate 定义中具有唯一的类型。我使用功能部署列表,在网站上创建列表实例,但我的工具栏没有出现。我使用描述的方法创建此工具栏 此处 和 这里,但它不起作用。
也许您可以获取一些有关该主题的有用资源,或者假设它可能不起作用的原因。谢谢。
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=" " 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否考虑过在 UI 功能区上创建自定义操作?我已经完成了一些事情,您可以将其应用于所有列表、您指定的一些列表,并且您不必经历创建 Web 部件并将其放置在页面上的痛苦。
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.