Sharepoint webpart combobox of lists

前端 未结 2 2177
不知归路
不知归路 2021-01-25 09:43

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

2条回答
  •  渐次进展
    2021-01-25 10:39

    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:

    1. Create your custom Toolpart class inheriting from Microsoft.SharePoint.WebPartPages.ToolPart
    2. In your custom Toolpart, override CreateChildControls, write the code to iterate over the lists in your SPWeb, and add those to a DropDownList
    3. In your webpart, override GetToolParts and add your custom ToolPart so that it shows up in the right hand side

提交回复
热议问题