花瓣网平面设计素材,做seo网站营销推广,图片展示型网站,有一个网站专门做促销小游戏WebPart学习 内容#xff1a; 功能简介 webpart的五个模式 自定义webpart部件 一、Webpart功能简介 1#xff0e; 自定义页面内容 2#xff0e; 自定义页面布局 3#xff0e; 导入、导出webpart 4#xff0e; 在不同部件间建立通信 5#xff0e; 管理和个性化的设置 二、…WebPart学习 内容 功能简介 webpart的五个模式 自定义webpart部件 一、Webpart功能简介 1 自定义页面内容 2 自定义页面布局 3 导入、导出webpart 4 在不同部件间建立通信 5 管理和个性化的设置 二、创建Webpart 1 用现成web控件建立 2 自定义webpart 继承自WebPart类 重要方法 public override void RenderControl(HtmlTextWriter writer) 三、WebPart的模式 WebPartManager1.DisplayModeWebPartManager.BrowseDisplayMode; WebPartManager1.DisplayModeWebPartManager.DesignDisplayMode; WebPartManager1.DisplayMode WebPartManager.EditDisplayMode; WebPartManager1.DisplayMode WebPartManager.CatalogDisplayMode; WebPartManager1.DisplayMode WebPartManager.ConnectDisplayMode; 对于后四个模式要使用下面的web.config中的个性化配置才能启用 webParts enableExporttrue personalization authorization allow usersgong verbsenterSharedScope/ /authorization /personalization /webParts 1. 浏览模式 显示部件不能作其它操作 2. 设计模式 可以删除拖放部件 3. 编辑模式 可以删除拖放部件 修改webpart的相关外观、行为和属性 4. 目录模式 支持导入、导出功能添加webpart控件 在目录模式中可以导出一个webpart 1.设置web.config webParts enableExporttrue personalization authorization allow usersgong verbsenterSharedScope/ /authorization /personalization /webParts 2.设置webpart控件的ExportMode属性为非None 5. 连接模式 多个webpart间数据的通信 Webpart连接 1 设置两个WebPart间的通讯接口 public interface ITestWord { string TestText { get; set; } } 2 实现提供者webpart public class TempWebpart : WebPart,ITestWord [Personalizable(true),WebBrowsable(true)] public string TestText //ItestWord接口数据实现 标记提供者函数 [ConnectionProvider(TestWordProvider,TestWordProvider)] public ITestWord ProvideTest() { return this; } 3 实现订阅者webpart public class TestConsumer : WebPart //标记订阅者函数 [ConnectionConsumer(TestWordConsumer,TestWordConsumer)] public void GetTest(ITestWord testWord) 4 界面设置 静态连接 asp:WebPartManager IDWebPartManager1 runatserver StaticConnections asp:WebPartConnection IDtt1 ProviderIDtemp1 ConsumerIDtestconsumer1 ProviderConnectionPointIDTestWordProvider ConsumerConnectionPointIDTestWordConsumer / /StaticConnections /asp:WebPartManager 动态连接 在asp:WebPartManager IDWebPartManager1 runatserver /asp:WebPartManager之间没有内容 下面的设置一样 asp:WebPartZone IDWebPartZone3 runatserver ZoneTemplate test:tempwebpart idtemp1 runatserver / /ZoneTemplate /asp:WebPartZone asp:WebPartZone IDWebPartZone4 runatserver ZoneTemplate test:testconsumer IDtestconsumer1 runatserver / /ZoneTemplate /asp:WebPartZone 转载于:https://www.cnblogs.com/erichzhou/archive/2007/04/05/700810.html