使用Visual Studio创建简单的自定义Web Part 部件属性

使用Visual Studio创建简单的自定义Web Part 部件属性

自定义属性使用额外的选项和设置拓展你的Web part部件。本文主要讲解如何使用Visual Studio创建简单的自定义Web Part 部件属性。
1. 打开Visual Studio,点击文件--新建项目--空白SharePoint项目CustomWPProperties。部署为场解决方案。
2. 右击项目添加新项Web Part部件WPPropertyExample,点击添加。
3. 右击WPPropertyExample.cs,点击查看代码。
4. 添加代码,最后是这样的:
5. 点击生成--部署解决方案。
6. 在SharePoint站点,点击网站操作--编辑页面--添加Web部件,在Custom类中选中WPPropertyExample,点击添加。
7. 编辑这个Web部件,在属性窗格可以看到:

原文地址:https://www.cnblogs.com/crazygolf/p/3856706.html