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

推荐订阅源

V
Vulnerabilities – Threatpost
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
P
Palo Alto Networks Blog
大猫的无限游戏
大猫的无限游戏
量子位
S
Secure Thoughts
博客园 - 【当耐特】
V
Visual Studio Blog
腾讯CDC
爱范儿
爱范儿
Webroot Blog
Webroot Blog
The Register - Security
The Register - Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Latest news
Latest news
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Cloudbric
Cloudbric
T
Troy Hunt's Blog
S
Security @ Cisco Blogs
B
Blog RSS Feed
I
Intezer
S
SegmentFault 最新的问题
N
News and Events Feed by Topic
云风的 BLOG
云风的 BLOG
C
CXSECURITY Database RSS Feed - CXSecurity.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
TaoSecurity Blog
TaoSecurity Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Recorded Future
Recorded Future
Google DeepMind News
Google DeepMind News
Forbes - Security
Forbes - Security
雷峰网
雷峰网
博客园 - 司徒正美
C
Cisco Blogs
S
Securelist
L
LINUX DO - 最新话题
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
N
News | PayPal Newsroom
N
News and Events Feed by Topic

博客园 - 星宿.NET

MOSS SSO -2147217900调用 SPS Single Sign-on 失败。返回的错误代码为“-2147217900”。 错误 数据关系图出现“此数据库没有有效所有者”错误的解决方法 - 星宿.NET - 博客园 SQL 语句建立连接服务器 SQL语句进行left join的时候发生Cannot resolve collation conflict for equal to operation.错误 列出域中所有用户的代码 跟我一起学Windows Workflow Foundation(7)-----给定制活动添加有效性验证 跟我一起学Windows Workflow Foundation(6)-----制作一个基本的定制活动 treeview控制checkbox修改版(2) treeview控制checkbox修改版(1) [转载]Asp.Net2.0权限树中Checkbox的操作 通过WPF/E制作一个从数据库读取数据的图谱 [转载]如何使用 Visual C# 2005 或 Visual C# .NET 向 Excel 工作簿传输数据 跟我一起学Windows Workflow Foundation(5)-----使用activity设计器创建一个整合的定制activity 跟我一起学Windows Workflow Foundation(4)-----使用Listen,Delay,和其他envnt-based定制活动 跟我一起学Windows Workflow Foundation(3)-----使用If/Else活动,定制活动处理工作流,使用事件传递数据 和我一起学Windows Workflow Foundation(2)-----让WF通过参数接收数据 和我一起学Windows Workflow Foundation(1)-----创建和调试一个WF实例 将visual studio 2005 SP1补丁整合到安装文件 创建或修改WSS的主题
初学使用sharepoint 2007 用户控件包装器 QuickPart
星宿.NET · 2006-12-01 · via 博客园 - 星宿.NET
 

最近要在sharepoint2007下做个webpart,可是又没有在07下做webpart的经验,所以在学习使用,今天先来说说使用涂老大的07版的用户控件包装器来制作webpart的过程。各位老鸟不要BS偶这个初学webpart的人,哈。

先从这里去下载涂老大(kaneboy)制作的最新版本for sharepoint 2007的用户控件包装器QuickPart下载下载后解压,按照说明进行部署。

1、将QuickPart.dll拷贝到MOSS2007站点根目录下的/bin目录中;

2、打开MOSS2007站点根目录下的web.config文件,在“<SafeControls>”节点中添加一个新的“<SafeControl>”子节点,如下:

<SafeControl Assembly="QuickPart" Namespace="Microsoft.PRC.SharePoint.WebPartPages" TypeName="*" Safe="True" />


<Trust Level="WSS_Minimal" ...

更改为

<Trust Level="Full" ...


3
、按下面的方法将QuickPart添加到MOSS2007站点集的WebPart库中:打开MOSS2007站点的设置页面,点击“Galleries”(库)下的“Web parts”,打开"Web Part Gallery"Web部件库)页面,点击“New”,然后找到“Microsoft.PRC.SharePoint.WebPartPages.QuickPart”,选中它前面的CheckBox,然后点击页面上方的“Populate Gallery”(导入库),这时应该能够在“Web Part Gallery”(web部件库)页面中找到“QuickPart.webpart”了。


看到
QuickPart.webpart 这个新导入的控件,说明我们已经把QuickPart安装好了。

下面先做一个简单的webpart试试。

创建一个新的网站项目,里面添加一个用户控件WebpartTest.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebpartTest.ascx.cs" Inherits="WebpartTest" %>

my first webpart

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

后台代码:

using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class WebpartTest : System.Web.UI.UserControl

{

private static string _myString = "000";protected void Page_Load(object sender, EventArgs e)

    {

        Label1.Text 

= _myString;

}

//自定义属性,可以自己设置值。显示在页面上

    [WebBrowsable(
true), Personalizable(true), WebDescription("描述内容"), WebDisplayName("显示的内容")]public string myString

    {

get

        {

return _myString;

        }

set

        {

            _myString 

= value;

        }

    }

}

测试这个用户控件运行正常以后对网站进行发布,用以生成对应的dll(当然,如果把后台代码写在ascx里就没这问题拉)。


钩选使用固定名称程序集,这样会给每个页面生成一个程序集。当然,包括
ascx控件自身也会生成一个dll,这个dll就是我们需要的。


根据目标位置找到我的控件
WebpartTest.ascxApp_Web_webparttest.ascx.cdcab7d2.dll

WebpartTest.ascx 文件复制到站点根目录下的/wpresources中,dll复制到站点根目录下的/bin中。

在网站首页试验一下:网站操作---编辑页面---随便找一个web区域添加web部件。


添加
QuickPart.


User Controls
里选择我们创建的用户控件WebpartTest.点确定。此时控件部署完成。


这时显示的
000为初始值,我们通过代码中设定的myString来自己定义它。重新选择编辑---修改web共享部件。

 

可以砍刀显示的内容里写的000,我们修改它的值,然后然后点应用,确定,可以看到值已经修改成我们新填的值
 

即使关掉IE重新打开,值也不变。