Sharepoint Web 部件列表组合框
我有一个基于列表工作的 Web 部件,但我想要创建一个包含共享点列表列表的下拉列表,以便当用户编辑页面并选择“修改共享 Web 部件”时,他们可以选择一个列表item 并被解析回 web 部件。
任何示例或示例链接表示赞赏!
谢谢丹
I have a webpart that works off of a list but what I'm trying to do create a dropdown that contains a list of sharepoint lists so that when the user edits the page and selects 'modify shared webpart' they are able to choose a list item and that gets parsed back to the webpart.
Any examples or links to examples appreciated!
Thanks
Dan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在寻找的东西称为“工具部件”。查看此示例以获取教程关于如何创建一个。
总的来说,您的一般步骤如下:
Microsoft.SharePoint.WebPartPages.ToolPart
的自定义 Toolpart 类CreateChildControls
,编写要迭代的代码SPWeb 中的列表,并将它们添加到 DropDownListGetToolParts
并添加您的自定义 ToolPart,以便它显示在右侧What you are looking for is called a Toolpart. Take a look at this example for a tutorial on how to create one.
Overall, your general steps will be:
Microsoft.SharePoint.WebPartPages.ToolPart
CreateChildControls
, write the code to iterate over the lists in your SPWeb, and add those to a DropDownListGetToolParts
and add your custom ToolPart so that it shows up in the right hand side听起来您想创建一个自定义编辑器部分。在该部分中,您将有一个下拉列表显示列表的名称(您可能想要过滤隐藏列表和空列表),并且当从列表中选择一项时,第二个下拉列表将显示所选项目的“标题”列列表。
这里有一些代码(在此处编辑,因此需要清理)来帮助您开始:
It sounds like you want to create a custom editor part. In the part you would have one dropdown that shows the names of the lists (you probably want to filter hidden and empty lists) and, when an item is selected from the list, a second dropdown shows the Title column of the items from the selected list.
Here's some code (edited here, so it will need to be cleaned up) to help you get started: