惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
WordPress大学
WordPress大学
Help Net Security
Help Net Security
Jina AI
Jina AI
Security Latest
Security Latest
Y
Y Combinator Blog
Project Zero
Project Zero
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
Know Your Adversary
Know Your Adversary
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
NISL@THU
NISL@THU
Cisco Talos Blog
Cisco Talos Blog
博客园 - 司徒正美
MyScale Blog
MyScale Blog
Cyberwarzone
Cyberwarzone
D
Docker
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
C
CERT Recently Published Vulnerability Notes
B
Blog
L
LangChain Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
SecWiki News
SecWiki News
The Hacker News
The Hacker News
C
Check Point Blog
L
Lohrmann on Cybersecurity
V2EX - 技术
V2EX - 技术
S
Securelist
T
Threat Research - Cisco Blogs
Stack Overflow Blog
Stack Overflow Blog
TaoSecurity Blog
TaoSecurity Blog
云风的 BLOG
云风的 BLOG
Latest news
Latest news
人人都是产品经理
人人都是产品经理
L
LINUX DO - 最新话题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Register - Security
The Register - Security
Webroot Blog
Webroot Blog
Simon Willison's Weblog
Simon Willison's Weblog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Security Blog
Microsoft Security Blog
AWS News Blog
AWS News Blog
C
Cybersecurity and Infrastructure Security Agency CISA
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
小众软件
小众软件
T
Tailwind CSS Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
宝玉的分享
宝玉的分享
O
OpenAI News

博客园 - 大熊(BigBear)

ADO.net实现批量SQL操作. - 大熊(BigBear) - 博客园 Application_AcquireRequestState事件,导致Ajax客户端不能加载 CSLA.Net在Web项目中使用SQL2005的分页 Moss中Form验证中"找不到匹配项"问题的处理 对于知识库系统建设的思考 知识管理中知识地图详解〔转〕 知识管理中的一些概念 Aop面向方面编程之PostSharp框架 [摘]IIS上部署WCF的问题 Linq使用之分组 Silverlight表格绑定中的一点细节处理 页面加载性能的优化 由一棵树绑定引发的遐想 IBatis.Net使用MemCached替换内置缓存策略 .Net下调用Java安全Web服务 Webpart深入(二) ASP.NET MVC 中文文档3 ASP.NET MVC 中文文档2 ASP.net MVC 中文文档1
Webpart深入(一)
大熊(BigBear) · 2009-02-26 · via 博客园 - 大熊(BigBear)

因为最近一个项目需要使用Webpart技术, 对于这个.net2.0时代的事物, 我算是个后进生, 所以只得临时抱佛脚.遇到了一些问题,顺道总结一下.

1.  自定义个性化Provider: 继承PersonalizationProvider,重载其中的关键虚方法即可. 很多文章讲述到这个,不在累述.

2.  自定义的目录列表: 我想实现的效果是, webpart的目录视图中, 可以从数据库中动态的加载一个用户可供使用的webpart组件列表.

这个时候, 我们需要继承System.Web.UI.WebControls.WebParts.CatalogPart,重载其中的GetAvailableWebPartDescriptions()GetWebPart(WebPartDescription description)方法.类似如下代码:

Code

在页面上使用时放入CatalogZone.另外DeclarativeCatalogPart中的属性WebPartsListUserControlPath也很好用, 可以指向一个用户控件, 这个用户控件页面中包含几个Webpart组件, 目录的列表中就有几个, 也算是比较动态了.

Code

3.  不让用户在界面上重复的添加同一个Webpart控件: WebPartManager控件有个OnWebPartAdding, 在组件被添加到界面前触发, 利用这个机会,就可以进行判断.

Code

4.  只有用户拥有权限的Webpart才在界面上显示出来. WebPartManager类在加载每个Webpart组件时都有一个onauthorizewebpart事件, 在事件中判断用户对这个Webpart的权限, 这样即便是这个组件在共享视图中, 没有权限也不会显示出来.

Code