Saturday, 18 April 2015

How to create custom master page in SharePoint 2010 using visual studio


how to create custom master page in sharepoint 2010 using visual studio

In this Article I will explain how to create and deploy master page using visual studio 2010.
I am created an Empty solution with name MasterPageTest as shown Below.
 Now right click on the solution add new item Module as shown below

 Now we can able to see the txt file
              Now I am rename sample.txt as SampleMaster.Master.
              After completing these steps.
              Go to site setting->MasterPage->

             Select the V4 master page Download a copy in to your system.
            Copy that code and paste in to SampleMaster.Master.
             In Element.xml we have to modify the code like this

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="TestExample" Url="_catalogs/masterpage">
<File Path="TestExample\SampleMaster.Master" Type="GhostableInLibrary"Url="TestExample/SampleMaster.Master" IgnoreIfAlreadyExists="TRUE" />
</Module>
</Elements>
          I am adding the H1 tag DotNet SharePoint Site in my Master Page.

           Deploy the Solution,After Deploying Successfully.

            Go to site setting → Galleries->
                                         
                     We can able to see the Module name with Pending Status  

                  Click on that Module name select Approved option Click ok  

      We have active two features,One is in Site Setting->Site Collection administration ->Site         Collection features.
                             

     In Site Actions->Manage Site Features.

                                                                      

  
         After Activating go to Look and Feel ->MasterPage
        Select our master we deployed from VS2010  
                             
        After Selecting master page at site master page and system master page Click ok .

       Finally we can able to see my master page .





No comments:

Post a Comment