In this article I am going to explain how to create a custom Application Page using visual studio 2010.
Creating Empty SharePoint Project:
- Open Visual Studio 2010 as an administrator.
- Go to File à New à Project.
- Select 2010 from the installed templates SharePoint and choose Empty SharePoint Project.
- Name it as SharePointProject.
- Click OK.
- Enter the SharePoint server farm URL.
- Select 'Deploy it as a Farm Solution".
- Click Finish.
Adding Application Page:
- Right click the Solution Explorer and select Add a new item.
- Select Application Page from the installed templates SharePoint and name it
as ApplicationPage.aspx.
- Once you add the application page it will automatically create the Layouts Folder.
- In the solution explorer you could see Layouts à SharePointProject à ApplicationPage.aspx.
- Once you deploy the solution the pages will be automatically placed in the layouts folder.
- Open ApplicationPage.aspx from the solution explorer. Here you can change the layout of the page.
- You can also change the "PlaceHolderPageTitle" content.
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ApplicationPage.aspx.cs" Inherits="SharePointProject.Layouts.SharePointProject.ApplicationPage" DynamicMasterPageFile="~masterurl/default.master" %>
<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
Application Page
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
My Application Page
</asp:Content>
- Go to the ttp://servername:2010/_layouts/SharePointProject/ApplicationPage.aspx.
- A new custom application page has been created in SharePoint 2010 as shown below.
Thanks for reading this article. I think this will help you a lot.
Leave Comment