Blue Theme Orange Theme Green Theme Red Theme
 
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
Discover the top 5 tips for understanding .NET Interop
Search :       Advanced Search »
Home » SharePoint » How to create custom SharePoint 2010 Application Page using Visual Studio 2010

How to create custom SharePoint 2010 Application Page using Visual Studio 2010

In this article we are going to create a custom Application Page using visual studio 2010.

Author Rank :
Page Views : 9599
Downloads : 0
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
Team Foundation Server Hosting
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 


In this article we are going to create a custom Application Page using visual studio 2010.

Steps Involved:

Creating Empty SharePoint Project:
  • Open Visual Studio 2010. 
  • Go to File => New => Project. 
  • Select 2010 from the installed templates SharePoint and choose Empty SharePoint Project. 
  • Name it as CustomApplicationPage.

    1.gif

  • Click Add. 
  • 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 CustomApplicationPage.

    2.gif

  • Once you add the application page it will automatically create the Layouts Folder.
  • In the solution explorer you could see Layouts -> CustomApplicationPage ->CustomApplicationPage.aspx.
  • Once you deploy the solution the pages will be automatically placed in the 14 hive layouts folder.
  • Open CustomApplicationPage.aspx from the solution explorer.
  • In the "PlaceHolderMain" add one asp label control.
  • And change the "PlaceHolderPageTitle" content to 'My Application Page" as shown in the following code.

    <%
    @ 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="CustomApplicationPage.aspx.cs" Inherits="CustomApplicationPage.Layouts.CustomApplicationPage.CustomApplicationPage" 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">My Application Page
      <asp:Label runat="server" Text="My Custom Page"></asp:Label>
    </asp:Content>
    <asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
    My Application Page
    </asp:Content>

  • Build the solution. 
  • Deploy the solution.
Testing:
  • Go to the http://servername:2010/_layouts/CustomApplicationPage/ CustomApplicationPage.aspx.
  • A new custom application page has been created in SharePoint 2010 as shown below.

    3.gif
Summary:

This article is mainly written to explain that a new template "Application Page" is available in the installed templates "SharePoint " -> "2010" and how to use that in visual studio 2010. 

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Vijai Anand

Vijai Anand write articles and blogs related to SharePoint 2010, Silverlight, SharePoint Workspace, SharePoint Designer 2010, Powershell and C #. He currently holds Mindcracker MVP. He has written an eBook on Business Data Connectivity Services in SharePoint 2010. eBook URL: http://www.itfunda.com/business-data-connectivity-services-in-sharepoint-2010-tutorials-ebook/Show/61  http://anavijai.wordpress.com

Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the Top 5 .NET Memory Management Fundamentals
To write the best .NET code, you need to know exactly how the .NET framework really manages memory. Ricky Leeks presents the Top 5 fundamental facts of .NET memory management. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Nevron Chart
Become a Sponsor
 Comments
Creating Custom Login Page Using VB.NET in VS 2008 by vivek On December 13, 2010
Hi, I am using VS 2008 and Sharepoint 2010. I was able to implement FBA on my site. Now I want to create a Custom Login Page for my Site so i can redirect user after the authentication. I am using Visual Studio 2008 for my code. I dont see the option of creating Empty SharePoint Project when I start a new project in Visual Studio 2008. Do I have to have VS 2010 for this or I can download these templates from internet and then use VS 2008 to accomplish the same task. Please help. Thanks, Vivek
Reply | Email | Modify 
Depolying a custom site by William On February 9, 2011
Hi Vijai, your article is very impresive. I want to do something similar in SharePoint. Maybe you can help. I have a site, which is displaying the contant as an html. I want to display same data in SharePoint, but I am not sure I can do that. Does that application page supports html /css codes? So that I can just copy/paste the contact to the application page. Also, Will the new page enherit the site settings/etc from the parent site? Thanks in advance for your support.
Reply | Email | Modify 
thank you by Amirhossein On August 23, 2011
i use this post, it was very useful
Reply | Email | Modify 

 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.