How to make look your page like a standard SharePoint page?

 Posted by ArticlesMaint on 9/23/2009 | Category: SharePoint Interview questions | Views: 3378

In order to get the SharePoint look and feel we need to inherit from a SharePoint master page. As a rule you should always inherit from a SharePoint master page so that your sites have a consistent look and feel. So let’s modify our ‘SimplePage.aspx’. To get the SharePoint style we need to inherit from the SharePoint master page ‘Application.Master’.

We have now tailored the ‘simplepage.aspx’ source code as shown below. We need to do the following:-

• First refer the assembly using the ‘Assembly directive.
• Refer the masterpage files as ‘Application.master’.
• Import the sharepoint namespace. If we had used the behind code we would have imported this in the behind code itself.
• There are three placeholder one for title , one for centre area and one for the page title. We need to define the placeholders in the child page.


<!— First refer the assembly using the Assembly directive ->
<%@ Assembly Name="Microsoft.SharePoint,Version=, Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>

<!— Refer the master page from the _layouts directory ->
<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master"
Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" %>

<!—Import the sharepoint namespace ->
<%@ Import Namespace="Microsoft.SharePoint" %>

<!—This is the content holder for page title ->
<asp:Content ID="Content3" ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
Let's learn SharePoint....

<!- This is the place holder for data for main page area ->
<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderMain" runat="server">
Oh its Damn Simple.....

<!- This is the placeholder for page title area ->
<asp:Content ID="Content2" ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
SharePoint is Simple.....

LOL !...Your SharePoint page now looks like a page.

You can get the source of the simple inline ASPX file attached at the end of the article.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response