用DelegateControl实现webpart开发,布署与feature控制管理

用DelegateControl实现webpart开发,布署与feature控制管理

一、设计阶段。 

     一、新建一个项目叫workflowMenu,并创建一个用户控件wf_workflowMenu.ascx,完成控件开发工作。

     二、创建feature文件。在项目中新建一个文件夹命名为workflowMenu,并创建了两个xml文件,一个feature.xml和Control.xml,代码分别如下:

     feature.xml

 

     <?xml version="1.0" encoding="utf-8"?>
 <Feature Id="00BFEA71-2062-426C-90BF-714C59600178"
    Title="流程导航菜单控件"
    Description="流程导航菜单控件"
    Version="1.0.0.0"
    Scope="Farm"
    xmlns="http://schemas.microsoft.com/sharepoint/">
    <ElementManifests>
        <ElementManifest Location="Control.xml" />
    </ElementManifests>
 </Feature>

 

     Control.xml

     <?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
 <Control Id="workflowMenuId" ControlSrc="~/_ControlTemplates/workflowMenu/wf_workflowMenu.ascx" Sequence="100">
 </Control>
</Elements>

到此完成文件的设计。

二、部署阶段。

     一、将用户控件放到C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\目录下,

     如:C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\workflowMenu\wf_workflowMenu.ascx

     二、将项目中的workflowmenu文件夹拷贝到C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES目录下,

     文件如:C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\workflowMenu\feature.xml

             C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\workflowMenu\Control.xml                 

 

 

     三、安装Feature.stsadm 安装Feature.如下:

安装feature:stsadm –o installfeature –filename workflowMenu\feature.xm

激活feature:stsadm –o activatefeature –name workflowMenu

                 iisreset

     四、在页面或页面模板上应用上开发的用户控件。如:修改站点的masterpage文件,将下面的这段代码,加到你要放控件的位置:

 

          <asp:ContentPlaceHolder ID="PlaceHolderworkflowMenu" runat="server">
                                                                <SharePoint:DelegateControl runat="server" ControlId="workflowMenuId">
                                                                </SharePoint:DelegateControl>
          </asp:ContentPlaceHolder> 

三、查看成果。刚才设计的流程菜单已经显示在sharepoint的网页上,如下图:

用DelegateControl实现webpart开发,布署与feature控制管理

你可能感兴趣的:(delegate)