Sharepoint Custom Application Page
http://msdn.microsoft.com/en-us/library/bb418732.aspx
<%@ 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) {
SPWeb site = this.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” >
The Quintessential ‘Hello World’ of Application Page
</asp:Content>
Different project types.
Reading list and items from application page.
http://msdn.microsoft.com/en-us/library/bb418733.aspx
SPSite siteCollection = this.Site;
SPWeb site = this.Web;
// obtain query string values
string ListId = Request.QueryString["ListId"];
string ItemId = Request.QueryString["ItemId"];
// create list object and list item object
SPList list = site.Lists[new Guid(ListId)];
SPListItem item = list.Items.GetItemById(Convert.ToInt32(ItemId));
// query for information about list and list item
string ListTitle = list.Title;
string ItemTitle = item.Title;