MOSS应用程序页面的HelloWord示例代码
来源:互联网 发布:js上传图片跨域问题 编辑:程序博客网 时间:2024/06/12 01:26
下面是一个最简单的应用程序页面的示例代码,只要把页面拷贝到_layouts目录下即可。
<%@ Assembly Name="Microsoft.SharePoint, [full 4-part assembly name]"%>
<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master"
Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<script runat="server">
protected override void OnLoad(EventArgs e) {
SPSite siteCollection = SPContext.Current.Site;
SPWeb site = SPContext.Current.Web;
lblSiteTitle.Text = site.Title;
lblSiteID.Text = site.ID.ToString().ToUpper();
}
</script>
<asp:Content ID="Main" runat="server"
contentplaceholderid="PlaceHolderMain" >
Site Title: <asp:Label ID="lblSiteTitle" runat="server" />
<br/>
Site ID: <asp:Label ID="lblSiteID" runat="server" />
</asp:Content>
<asp:Content ID="PageTitle" runat="server"
contentplaceholderid="PlaceHolderPageTitle" >
Hello World
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" runat="server"
contentplaceholderid="PlaceHolderPageTitleInTitleArea" >
Hello World
</asp:Content>
<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master"
Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<script runat="server">
protected override void OnLoad(EventArgs e) {
SPSite siteCollection = SPContext.Current.Site;
SPWeb site = SPContext.Current.Web;
lblSiteTitle.Text = site.Title;
lblSiteID.Text = site.ID.ToString().ToUpper();
}
</script>
<asp:Content ID="Main" runat="server"
contentplaceholderid="PlaceHolderMain" >
Site Title: <asp:Label ID="lblSiteTitle" runat="server" />
<br/>
Site ID: <asp:Label ID="lblSiteID" runat="server" />
</asp:Content>
<asp:Content ID="PageTitle" runat="server"
contentplaceholderid="PlaceHolderPageTitle" >
Hello World
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" runat="server"
contentplaceholderid="PlaceHolderPageTitleInTitleArea" >
Hello World
</asp:Content>
这段代码把后台的onload代码写在了aspx页面上,但其实我更愿意使用code-behind的方式来编写代码。
比如我要建一个customlogin的项目,其中只有一个login.aspx页面,把它放在_layouts目录下的话,只需要把customlogin.dll放到/layouts/bin目录下即可。
但这样会有一个问题,_layouts目录下本身已经有名为login.aspx页面了,如果我们的页面也放在_layouts目录下,就会覆盖原有的login.aspx文件。所以,我们通常可以在_layouts目录下为我们的项目新建一个专门存放我们自定义文件的子目录。
如果想把login.aspx页面放到_layouts目录下的一个子目录下的话,那该子目录需要创建成虚拟目录才能使用code-behind的方式。即,创建子目录customlogin后,我们的login.aspx的存放路径就是_layouts/customlogin/login.aspx;而后台的customlogin.dll的存放路径就是_layouts/customlogin/bin/customlogin.dll。
- MOSS应用程序页面的HelloWord示例代码
- MOSS应用程序页面的HelloWord示例代码
- GEF入门级的helloword教程和示例工程代码
- ios的helloword代码编写
- MOSS/Sharepoint 控制视图页面访问权限开发的问题(代码法)
- 向MOSS页面中添加服务器端代码的另外一种方式 zt
- Linux下的第一个代码,HelloWord!
- MOSS 中提升代码的运行权限
- Swing HelloWord 示例
- spring helloWord 示例
- 第一个Helloword应用程序
- 开发电子邮件应用程序示例 代码
- 在MOSS 2007和WSS上的应用程序开发
- MOSS new SPSite时报应用程序错误的解决
- MOSS 高级搜索设置,如何过滤moss自带的功能页面
- 禁止MOSS页面个性化
- Moss 中的错误页面
- moss自定义登陆页面
- 在MyEclipse 6.5中配置ext开发环境
- 跨站点显示列表
- Android 七 Handler Bundle Message 简单用法
- 属性复制
- Javascript中的this
- MOSS应用程序页面的HelloWord示例代码
- 发布网站遇到的问题
- JAVA日期
- 三种数据转换的执行效率比较
- 文件删除 移动 新規
- android如何实现webkit开发
- 软件项目管理师复习指南一:信息系统开发基础
- 成功开发iPhone软件的10个步骤
- js闭包的用途