Thursday, April 19, 2012


I recently passed the MCTS SharePoint 2010 Application Development 70-573 exam. I thought it is good to share the list of resources that helped me with my amendment. 
Skills Being Measured:
• Working with the SharePoint User Interface (19%)
• Developing Web Parts and Controls (21%)
• Developing Business Logic (19%)
• Working With SharePoint Data (22%)
• Stabilizing and Deploying SharePoint Components (19%)
Working with the SharePoint User Interface (19%)
• Manage SPSite and SPWeb programmatically by using Visual Studio 2010
This objective may include but is not limited to: creating sub webs, referencing SPFiles, manipulating property bag, when to call Update, referencing SPContext, SPSite, SPWeb, SPSite.OpenWeb, SPWeb.Webs, feature activiation and deactivation.This objective does not include: trivial cases such as setting title and other loose properties of the objects
• Implement a dialog by using the Dialog Framework
This objective may include but is not limited to: Create dialogs from JavaScript or from server side, display dialogs
• Create a custom ribbon object
This objective may include but is not limited to: adding custom actions to the ribbon, customizing groups, customizing tabs, customizing the existing ribbon
• Customize navigation programmatically
This objective may include but is not limited to: TopNav bar, quick launch, custom actions
This objective does not include: custom menu controls, custom site map providers
• Create and apply branding to a SharePoint site
This objective may include but is not limited to: applying custom master pages to content pages and application pages, placeholders, page layouts, programmatically working with themes, deploying CSS, CSSlink, ScriptLink.This objective does not include: graphic design, creating a CSS
Developing Web Parts and Controls (21%)
• Create Web Parts
This objective may include but is not limited to: including properties, controls using Render vs. CreateChildControl, life cycle, visual, standard Web Parts,
This objective does not include: trivial case where developer uses Visual Web Part project template
• Create connectable Web Parts
This objective may include but is not limited to: Implement consumer/provider interfaces
• Debug Web Parts
This objective may include but is not limited to: ULS log, and event log, debug.log tracing, developer dashboard
• Create and implement delegate controls
This objective may include but is not limited to: overriding existing controls with lower sequence, developing and using .ascx files
Developing Business Logic (19%)
• Implement a custom workflow in Visual Studio 2010
This objective may include but is not limited to: work with inititation data or association data to create a SharePoint task, extend a workflow imported from SharePoint Designer 2010, use a HandleExternalEvent and CallExternalMethod to interact with a custom local service, work with inititation data or association data in a site workflow, corelation token
This objective does not include: trivial cases such as workflows with no custom actions, initiation data, association data.
• Create a custom workflow action
This objective may include but is not limited to: create a custom SPD action, create and add a custom activity to a Visual Studio workflow, define an action.xml file
• Create and implement event receivers
This objective may include but is not limited to: accessing event properties, list, item, site, email, avoiding recursion, cancelling events, choosing synchronization state
• Customize Enterprise Content Management (ECM)
This objective may include but is not limited to: creating a content type that inherit from appropriate parent, creating and implementing a custom publishing field control that is page mode aware, activating a master page programmatically including token usage
This objective does not include: page layouts, formatting
• Create, implement and debug a Timer Job
This objective may include but is not limited to: configuration, programmatic scheduling, queueing, attaching debugger to the Timer service
• Create and modify Business Connectivity Service model in Visual Studio 2010
This objective may include but is not limited to: create a BDC model in Visual Studio 2010, define insert, update and delete methods, create and read items, make data searchable
• Manage Users, Groups, Permissions
This objective may include but is not limited to: SPGroups, SPUser, permission inheritance, all securable objects, SPRoleDefinition, SPRole, SPRoleAssignment
Working With SharePoint Data (22%)
• Access list data by using the Server object model
This objective may include but is not limited to: SPQuery, LINQ, SPList, SPSiteDataQuery, schema management, working with a query Governor, create LINQ query that includes a join statement, SPQuery Vs. SPSiteDataQuery
• Access SharePoint Data by using WCF Data Services
This objective may include but is not limited to: WCF ListData.svc, RESTFUL URLs conventions, create and use a client service reference
• Access (CRUD) data by using the Client Object Model
This objective may include but is not limited to: Javascript, .NET, Silverlight, Build Silverlight User Interface for SharePoint using Client Object Model, Query data by using CAML over the Client Object Model in Silverlight, non data API (site, web, list, access)
• Work with documents programmatically
This objective may include but is not limited to: SPFile, SPFolder, SPVersion, upload document and set meta data
• Work with the meta data
This objective may include but is not limited to: Access data from user profiles, taxonomy, folksonomy
• Extending SharePoint Search
This objective may include but is not limited to: creating a custom query using full text query or keyword query, customize the look and feel of the search result using XSLT
• Implement and debug code that executes in an alternative security context
This objective may include but is not limited to: create code that uses the RunWithElevatedPrivileges delegate (including debugging), create code that uses the System Account, create code that impersonate a different user
• Create and modify a custom content type
This objective may include but is not limited to: declaratively and programmatically creating and upgrading content type using Visual Studio 2010, modifying an exisiting content type, site columns
Stabilizing and Deploying SharePoint Components (19%)
• Manage a solution in Visual Studio 2010
This objective may include but is not limited to: modify the contained features in the solution, add an assembly that is not included in the visual studio solution, manage mapped folders for localization, sandbox and farm solutions, customize manifest.xml
• Manage a feature by using Visual Studio 2010
This objective may include but is not limited to: upgrading, localizing, versioning, developing features, feature receivers (activating and installing) that interact with their parent object, customizing feature.xml
This objective does not include: features without elements
• Store and retrieve configuration data
This objective may include but is not limited to: App config, web config, persisted object, list, xml, file system, cookies, property bag
• Create a site definition by using Visual Studio 2010
This objective may include but is not limited to: feature activation, site provisioning, localization
This objective does not include: list definitions and modules defined in ONET.xml, SharePoint Designer
• Manage SharePoint object life cycle by using the Dispose API
This objective may include but is not limited to: SPWeb, SPContext, IDisposable, Try...Catch...Finally, using blocks
• Develop, debug, and deploy sandboxed solutions
This objective may include but is not limited to: APIs that are allowed or not allowed in sandbox, use a full trust proxy
Reference
http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-573&locale=en-us#tab2
Please find below some of the articles that helped me to get MCTS in SharePoint 2010
1. http://blog.beckybertram.com/Lists/Exam%2070573%20Study%20Guide/AllItems.aspx
2. http://weshackett.spaces.live.com/blog/cns!41B731D6A8FE484A!463.entry?sa=632404373
3. Don't forget to refer MSDN Virtual Lab(Check Preparation Tools and Resources TAB)
4. http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-573&locale=en-us#tab3
5. If you already worked in SharePoint 2007 object model it will help you in 2010

Tuesday, April 17, 2012

Ribbon 2010

Architecture of the Server Ribbon

The Server ribbon in Microsoft SharePoint Foundation 2010 creates a consistent user interface for working with SharePoint objects. You can extend the ribbon declaratively using Server ribbon XML and simple ECMAScript (JavaScript, JScript), or you can use ribbon XML and a page component for more advanced scenarios.

Basic Objects in the Server Ribbon
The top-level elements in the ribbon are tabs. Tabs appear across the top of the page in a SharePoint site. Each tab organizes a set of groups. These groups contain sets of controls. Each group can contain multiple controls and has a label to identify each group. The controls inside the group include buttons, drop-down menus, check boxes, combo boxes, split buttons, and galleries. Each of these controls is tied to a unique command.

 


What is Ribbon feature in sharepoint 2010.
Ribbon in sharepoint 2010 provide a consistence UI interface. Ribbon is the new feature provided by sharepoint 2010 which introduced tabs, group,controls on the header section of site. tab is the top element of ribbon framework, tabs associated one or multiple groups and groups associate one or multiple controls, every control can be used in the tabs including the button,dropdown,label etc as well as some new controls has also been introduced........... ribbon does not have the facility to used custom control or user control. a particuler control can not be hide or show while whole ribbon can be shown or hide.
Below is the ribbon architect.
IRibbonMenu- provide ribbon interface to implement
SPRibbonButton-
SPRibbonMenu-
SPRibboncommondUI-
SPRibbonQuery-
http://msdn.microsoft.com/en-us/library/gg552606.aspx
http://www.c-sharpcorner.com/uploadfile/anavijai/create-a-custom-tab-in-the-sharepoint-ribbon-interface/  created custom tab group control

The purpose behind ribbon architecture to provide a more user driven interface in sharepoint 2010. ribbon architect came after much research and discussion. Ribbon interface allows the component controls which must be associated the current activity such as while adding the text into document there is no need to display the controls to insert images and tables in microsoft 2010 while entering text into document a seprate tab is provided to insert the images and tables.

Sharepoint 2010 server ribbon architect
The default ribbon is built by sharepoint from the installation of sharepoint 2010. The ribbon interface is based on the the file CMDUI.xml which is the part of site defination from which site is created. The location of xml file is (Root web)\Template\Globle\xml\

SharePoint 2010 Server Ribbon Component
Tab :
Group:
Controls:
Contextual tab group:

Tabs on the SharePoint 2010 Server Ribbon
Tabs are the root of server ribbon components. Tabs contain one or more group and similar functionality.

Groups on the SharePoint 2010 Server Ribbon. : - 
Every tab contains the one or more group,  Groups are associated with one or multiple controls and similer functionality each group can have a title. Each group is defined by a template which is used to define the layout of group and how it will apear on the scalling of group. Scaling refer to the situation where there is too many controls to show in the ribbon.

Controls : Without controls the ribbon framework is nothing. controls refer to the items on which an action is performed each group can have multiple controls and there are a set of controls which can be defined into server ribbon framework like button,dropdown,listbox, etc.

Group Templates on the SharePoint 2010 Server RibbonGroup templates are used to define the different layout options for the controls within a group. Microsoft includes 29 group templates in the CMDUI.xml file (to locate them, search for the element <RibbonTemplates /> at the end of this file).

Contextual tabs :
Contextual tab groups are used to provide functions that are not global to the current context, such as the page. They appear only when certain circumstances have been met and contain one or more tabs.

Adding the cusom button into document tab of shared document lib, for this we created a empty site and empty element in which we have the xml
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
  Id="DemoHelloWorldButton"
  RegistrationType="List"
  RegistrationId="101"
  Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
         Location="Ribbon.Documents.New.Controls._children">
          <Button
           Id="Ribbon.Documents.New.Controls.DemoHelloWorldButton"
           Alt="Hello World Ribbon Button"
           Sequence="10"
           Image32by32="/_layouts/images/PPEOPLE.GIF"
           Command="Demo_HelloWorld"
           LabelText="Hello World Demo"
           TemplateAlias="o2"/>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
         Command="Demo_HelloWorld"
         CommandAction="javascript:alert('Hello World!');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>


This example shows how to create Custom Tab, Custom Group , Custom Control using the ribbon

<?xmlversion ="1.0"encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="CustomRibbonTab"
    Location="CommandUI.Ribbon"
    RegistrationId="101"
    RegistrationType="List">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
         Location="Ribbon.Tabs._children">
          <Tab
            Id="Ribbon.CustomTab"
            Title="Custom Tab"
            Description="Custom Tab !!!"
            Sequence="501">
            <Scaling
              Id="Ribbon.CustomTab.Scaling">
              <MaxSize
                Id="Ribbon.CustomTab.MaxSize"
                GroupId="Ribbon.CustomTab.CustomGroup"
                Size="OneLargeTwoMedium"/>
              <Scale
                Id="Ribbon.CustomTab.Scaling.CustomTabScaling"
                GroupId="Ribbon.CustomTab.CustomGroup"
                Size="OneLargeTwoMedium" />
            </Scaling>
            <Groups Id="Ribbon.CustomTab.Groups">
              <Group
                Id="Ribbon.CustomTab.CustomGroup"
                Description="Custom Group!"
                Title="Custom Group"
                Sequence="52"
                Template="Ribbon.Templates.CustomTemplate">
                <Controls Id="Ribbon.CustomTab.CustomGroup.Controls">
                  <Button
                    Id="Ribbon.CustomTab.CustomGroup.CustomButton"
                    Command="CustomTab.CustomButtonCommand"
                    Sequence="15"
                    Description=""
                    LabelText="Custom Button"
                    Image32by32="/_layouts/images/PPEOPLE.GIF"
                    TemplateAlias="cust1"/>
                  </Controls>
                </Group>
              </Groups>
            </Tab>
        </CommandUIDefinition>
        <CommandUIDefinition Location="Ribbon.Templates._children">
          <GroupTemplate Id="Ribbon.Templates.CustomTemplate">
            <Layout
              Title="OneLargeTwoMedium"
              LayoutTitle="OneLargeTwoMedium">
              <Section Alignment="Top"Type="OneRow">
                <Row>
                  <ControlRef DisplayMode="Large" TemplateAlias="cust1" />
                </Row>
                </Section>
              </Layout>
            </GroupTemplate>
            </CommandUIDefinition>
          </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
         Command="CustomTab.CustomButtonCommand"
          CommandAction="javascript:alert('Hello, world!');" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
  </Elements>


Server Ribbon Communication
The ribbon uses multiple objects to interact with the rest of the page. It must know which controls are enabled, the state of the controls, and when to refresh. The Server ribbon communicates by using the CommandDispatcher, PageManager, and PageComponent objects among others. Each of these objects plays an important role in interacting with the ribbon.
The PageManager initializes all of the controls and registers the PageComponent objects for the ribbon. One instance of the PageManager lives on the page.
The CommandDispatcher handles all of the PageComponent objects and the commands they can handle. When a command is received on the page, the CommandDispatcher receives the command and passes it to the correct PageComponent.
A PageComponent is created in ECMAScript (JavaScript, JScript) and handles commands passed by the CommandDispatcher. After the PageComponent is added to the page, you use JavaScript to create an instance of your PageComponent and register it with the PageManager. The PageComponent can then respond to the commands you defined in ribbon XML.

White paper blog links
http://msdn.microsoft.com/en-us/library/ff407290.aspx

Wednesday, April 11, 2012

Webpart/User control/Event handler/SPJob

What is web part why we use them what is web part life cycle
How many OOB web part you can use
How we add the property in Custom web parts
How many we you render the data into custom web part
How we implement user controls in custom web part
What is parent/child web part.
How many wany you can deploy the webparts
How many event we can implement the event handler

SiteColums/PageLayout/JavaScript

What is site columns and how we create them using xml and code
What is custom field control and how we implement those
What is content type and how we create them using xml and code
What is page layout
Why we need custom page layout
How we create the custom page layouts
How we use custom jss file in page layouts

Thursday, April 5, 2012

MasterPages/SiteDefvsTemplate/ApplicationPages

MasterPage

Master page provide the consistent look across the site. you can use custom master page to provide the look and feel of your website. Master page contains the common area and the contentplaceholders. The v4 master page contains 33 content placeholder which further overriden by the page.

What is master pages
Master pages define the common layout and interface for SharePoint pages. The master page displays the persistent elements that you expect to see when you navigate from page to page on a site. These elements can include a company logo, title, navigation menu, search box, and the colors or graphics associated with the business or organization. On a SharePoint site, you might also expect to see a persistent sign-in link, the Site Actions menu, and the Ribbon commands. These elements are all stored in a master page

 Master pages and content pages
On a typical SharePoint Team site (based on one of the site templates included with SharePoint), you see that the top and left regions come from the master page, while the middle and right regions come from the content page, in this case, the home page
While the master and content pages are separate, they are merged together at runtime to display as a single web page in the web browser. Both pages are ASP.NET pages, but master pages have a .master file extension and they contain the necessary ASP code and content regions to render both pages on a SharePoint site.

Master page content placeholders

Master pages and content pages work together using a set of replaceable regions, or content placeholder controls. Each content placeholder (which appears as ContentPlaceHolder in the page code) represents content that can be overridden on the master page. Any page on the site can replace whatever is contained within the content placeholder by supplying a matching content control. That content control can even be empty, which would remove the element entirely from the rendered page.
In the v4.master page in SharePoint 2010, there are approximately 33 content placeholders that are used to display content and functionality on a SharePoint site. You can see these controls when you open the master page directly. In SharePoint Designer 2010, you can use the Manage Content Regions feature to locate each content placeholder control on the page. You can view the control in both code view and the WYSIWYG editor. In the below example, you see the PlaceHolderSiteName control that is used to display the name of the site.
Another content placeholder that is particularly important is PlaceHolderMain because this is what gets replaced by each content page when that page is viewed in a web browser.
You can change the layout of content on a SharePoint site by changing the location of the content placeholder controls. You may, for example, choose to add more content to the right side of the page. You could do this by adding it to the right side of the master page.

Benefits of using master pages


Available master pages in SharePoint 2010

Primary master page
v4.master
Used for content and administration pages. Provides the interface and layout for SharePoint 2010.Team Site home page, list and library pages, and site settings page.
Minimal master page
minimal.master
Contains minimal SharePoint content, used for full-screen functionality or embedded applications.The home and search results pages on a Search Center, pages that host Word or Excel web applications.
Publishing master page
nightandday.master
Used for pages on a SharePoint Server publishing-enabled site.The home page, about us, or press release page on a publishing intranet, extranet, or Internet-facing site.
2007 default master page
default.master
Used to support legacy SharePoint sites, which haven’t been visually upgraded to SharePoint 2010.Home page, site pages, and list pages on a SharePoint 2007 site before visual upgrade.


What’s new with master pages in SharePoint 2010

New master pages in SharePoint 2010,
Primary master page used for site and application pages
Master page layout uses DIV tags
Master page features in SharePoint Designer 2010
Restricting access to master pages

Customizing master pages

The colors, graphics, text formatting, and other layout properties are specified in one or more Cascading Style Sheets (CSS) that accompany the master page. Most of the styles applied to the default primary master page originate from the core SharePoint CSS file, corev4.css. To style the contents of a master page, you override these styles and introduce new styles in your own style sheets. In sum, designing and branding a SharePoint sites typically involves customizing both the default primary master page and the styles associated with that master page

Site Definitions and Configurations

A site definition defines a unique type of Microsoft SharePoint Foundation website. Several site definitions are built into SharePoint Foundation. A site definition can include more than one site definition configuration. A SharePoint Foundation website is based on particular site definition configuration. For this reason, you can think of a site definition as a family of configurations, although some families contain only one configuration.
The following are the four site definitions whose configurations can be used to create new websites.
  • STS includes the site definition configurations for, Blank Site, Team Site, and Document Workspace.
  • MPS includes the site definition configurations for Basic Meeting Workspace, Blank Meeting Workspace, Decision Meeting Workspace, Social Meeting Workspace, and Multipage Meeting Workspace.
  • BLOG provides a site definition configuration for blogs.
  • SGS provides a site definition configuration for Group Work Site.
The following site definitions are also built into SharePoint Foundation, but they cannot be used as the basis for new sites.
  • CENTRALADMIN provides a site definition configuration for central administration websites.
  • TENANTADMIN provides a site definition configuration to support SharePoint Foundation site hosting features.
  • WIKI provides a site definition configuration for legacy wiki sites that were originally created in an earlier version of SharePoint Foundation. Because standard site pages on SGS sites are wiki-enabled pages, users do not have to create sites that are specifically for wikis.
  • GLOBAL provides a basic configuration used for initializing all other site configurations.
Each site definition consists of a combination of files that are placed in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\SiteTemplates subfolders of SharePoint Foundation servers during installation of SharePoint Foundation. The XML markup in the site definition files may include references to files in other subfolders of %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE, including .xml, .aspx, .ascx, and .master page files, in addition to document template files (.dot, .htm, and so on), and content files (.gif, .doc, and so on).


Site definition files are cached in memory on the server when first accessed at run time, which improves scalability and performance by reducing unnecessary data storage or retrieval, and by allowing uncustomized pages to be reused across sites. The information contained in these files is pulled from the cache for each subsequent request.
When site pages are customized, excluding browser-based customizations such as modifications to Web Parts, the pages and their contents are stored in the content database. Uploaded .aspx files are also stored in the database. The contents of customized pages are routed through safe mode parsing, which prevents unsafe server-side code from executing, and which depends entirely on the Safe Controls list—specified in the web.config file of the SharePoint Foundation application's subfolder in C:\Inetpub\wwwroot\wss\VirtualDirectories—to determine which controls can be rendered at run time.


 

Core Schema Files

 

The following are the prominent XML files that govern the structure and content of a site definition.

WebTemp*.xml Files
Identify the site definitions and configurations and provide information about how they appear in the user interface (UI) to users who are creating new websites.
Location: %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\1033\XML
Onet.xml Files
Define the navigation areas, specify the list definitions available in the UI, specify document templates and their files, define the base types for lists, and define configurations and modules for site definitions.
Location: %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\SiteDefinitions\site_type\XML

Each of these XML files uses Collaborative Application Markup Language (CAML) to define various aspects of a site.
The built-in WebTemp.xml file, and any supplemental WebTemp*.xml files that may have been deployed, specify which site definition configurations are available for creating sites. If you are creating a custom site definition, do not edit the original WebTemp.xml file. Instead, create a custom WebTemp*.xml file as described in How to: Create a Custom Site Definition and Configuration. SharePoint Foundation merges the contents of all WebTemp*.xml files when showing available site definition configurations in the UI. This simplifies installing and uninstalling site definitions, because their contents do not have to be merged into one WebTemp.xml file.
Onet.xml defines the top navigation and Quick Launch areas, specifies a basic set of list types that are available for creation, specifies document templates and their file types, and itemizes the files and "all user" Web Parts that are available for use in site configurations. The global Onet.xml file, from which all other Onet.xml files inherit, defines the base types for lists, which include Generic List, Document Library, Discussion Forum, Vote or Survey, and Issues List.
In addition, Onet.xml uses Configuration elements to define the site definition configurations in a site definition (such as STS and BLOG) and Module elements to define the modules in each site definition configuration. For more information about modules, see How to: Provision a File.
A Configuration specifies the set of lists, Features, and modules that are included when a site is created. For more information about site definition configurations, see How to: Create a Custom Site Definition and Configuration.

Site Defination :- New sites can be created from site defination. a new site defination can be created from the visual studio.net. A site defination contains the list defination, master page configuration and site action, web part configuration etc which is mendotry to create a site.

Site Template versus Site defination
This is really a common source of confusion among SharePoint developers. The fact that site definitions are located in a folder named SiteTemplates multiplies the confusion. Before going into direct comparison, let me define both:
Site Templates : Are  snapshots of  sites at a point in time. When a user customizes a site from the UI or SPD, the custom template consists of the difference between the original state of the site (determined by its definition) and the state of the site or list when the custom template is generated.
Custom templates remain tied to a particular site definition (for example, the site definition for SharePoint Web sites or Meeting Workspace Web sites), so that if the site definition is not present or is changed, the custom template cannot work.
Site Definitions : As the name implies, A Site definition is "core definition of a site”. Each site definition emerges through a combination of files that are placed in the 12 hive of WFE during installation of SharePoint. Site definition files include .xml, .aspx, .ascx, and .master page files, as well as document template files (.dot, .htm, and so on), and content files (.gif, .doc, and so on).
Now to the fun part, the comparison :
Site Definitions
Site Templates
Files are on disk, better performance.
Files are in database, less efficient.
Highly customizable and extensible (XML  and .NET code is much more flexible than UI)
Not easily extensible  (You are limited by what UI offers)
Can provision multiple webs *
Can only provision one web
Complex to create
Easier to create
Requires admin access to server for deploying.
Installable from a Web UI by site owners.
Modifying the site definition after provisioning at least one site from it is not supported and might break existing sites.
Custom templates can be modified without affecting existing sites that have been created from the templates(**).
* This could be achieved using Provisioning handler (For more info, refer to http://spcodesnippets.codeplex.com )
** Please note that If the site definition on which the custom template is based does not exist on the WFE, the custom template does not work.
On the surface, it appears that a site template has numerous advantages over site definitions; it is certainly easier to create and deploy, and you can change it without breaking sites that use earlier versions of the template because it is not centralized in the 12 hive. However, the fact that a site template contains everything about a site in a single file makes granular modifications of individual elements very difficult. For many projects, that is a good enough reason to suffer the additional complexity of site definitions.
However, site definitions present a different challenge. If you change an existing site definition in the 12 hive, you run the risk of breaking any sites that were created previously and use the existing definition. (Besides, this is not supported by Microsoft ) , The key is to adopt the same strategy as for the core WSS site definitions:
Keep the definition as simple as possible and use feature stapling for everything else. Feature stapling allows you to add a feature to an already existing site definition. You may think this would be a complete waste of time, because you can simply add the feature into the site definition using far less code than having a feature staple, but when I tell you that
Microsoft does not support modifying a site definition in any way after a single site has been provisioned from that site template, you may reconsider.
Features are not an alternative to site definitions. Features are a complement to site definitions. If you keep the site definition as simple as possible and use features for the majority of a site elements, you gain the benefits of granular control in the development environment while reducing the risks involved in making changes to production systems over the life of the sites.

How can we display a simple custom page in SharePoint? 
Ok first thing there is no concept of simple page in SharePoint. There are two types of pages in SharePoint as we discussed in the previous article one is an Application page and the other is the site page.

Application page is a generic page while site pages are custom to a website. To just cool you off lets display a simple Application page first.

Some points to be noted about Application pages:-

· They are pages which are shared across sites like 'settings.aspx' , which will helps us set generic properties across sites in a site collection.
· The second important part is that we need to save application pages in 'C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS' folder. If you browse to the folder you will find SharePoint's own application pages.
Ok, what we will do is that to build confidence let's make a simple page called as 'SimplePage.aspx'. We are not doing anything great in this we will just write this simple sentence inside the page.

<b> Ohhhh I never Knew SharePoint is so easy </b>
Once you have saved the page just browse to the IIS application and browse to the _layouts folder as shown in the figure below. If you open the page in browser you should see your display message. 
Note: - For the next question you need to understand the concept of master pages. If you have not please read it once. Consistent look and feel is one of the most important factor in enterprise portal and SharePoint achieves the same using Master pages. 

The above page does not look like a standard SharePoint page?
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=12.0.0.0, 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....
</asp:Content>
<!- This is the place holder for data for main page area ->
<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderMain" runat="server">
Oh its Damn Simple.....
</asp:Content>
<!- This is the placeholder for page title area ->
<asp:Content ID="Content2" ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
SharePoint is Simple.....
</asp:Content>

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. 
Some couple of points we need to take care regarding implementing behind code in ASP.NET are the following:-
· The first and foremost requirement is that behind code should be registered in to the GAC assembly. In other words we need to code the behind code in a separate assembly / namespace and then compile the same in a DLL. Later we need to register the DLL in GAC.
· Second we need to use the assembly directive to refer the behind code.
Step 1:- So the first step is to make two solution files one is the behind code which goes in separate assembly 'ClassLibrary1' namespace and the other is the ASP.NET web project which has the 'SimplePageCodeBehind.aspx'. We also need to register this DLL in a GAC. So you need to generate a strong name give to the assembly and register the same using the 'GACUTIL' provided by the .NET framework.


Step 2:- The behind code is in a separate assembly as need to register the same in the GAC. We have kept the behind code simple. We have create two label objects and set the value. One of the important points to be noted is that we have referenced the 'System.Web.UI' namespace DLL and 'Microsoft.SharePoint' namespace DLL. The other point to be noted is that the class inherits from 'LayoutsPageBase' class which belongs to 'Microsoft.SharePoint' namespace.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;

// need to refer the UI objects of ASP.NET
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

// Need to refer the SharePoint DLL
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace ClassLibrary1
{

    // Inherit the behind code from 'LayoutsPageBase' class of SharePoint

    public partial class _Default : LayoutsPageBase
    {

        protected Label lblSiteQuestion;
        protected Label lblSiteAnswer;

        protected override void OnLoad(EventArgs e)
        {
            lblSiteQuestion.Text = " How can we implement behind code in SharePoint ?";
            lblSiteAnswer.Text = " We need to register the behind DLL in GAC";
        }
    }
}

We need to also register the above DLL in GAC. So we need to generate a strong name and register the same using GACUTIL.Step 3:- Now comes the UI part of the ASP.NET i.e. the ASPX page. Below is the code snippet which shows how the ASP.NET UI looks like.

The first thing to note is that behind code is not referred as code behind but is referred using the GAC public token key. In order to refer it using GAC key we need to use the 'Assembly' attribute for the same.

We have also inherited from the master page file i.e. 'Application.Master' so that we have a consistent look and feel.

<!-Refer the sharepoint assembly ->

<%@ Assembly Name="Microsoft.SharePoint,Version=12.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>

<!-Refer the behind code, Note that the behind code is coded in a different assembly and registered in the GAC ->

<%@ Assembly Name="ClassLibrary1, Version=1.0.0.0, Culture=neutral,PublicKeyToken=af6d081bf267e17e" %>

<!- In order to maintain consistent look and feel we need to inherit from the Application.Master page ->

<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master" Inherits="ClassLibrary1._Default" EnableViewState="false" EnableViewStateMac="false"%>



Once we have referred the Assembly and set the Page attributes. Its time to fill the content in the placeholders defined in the master page 'Application.Master'.

<asp:Content ID="Main" contentplaceholderid="PlaceHolderMain" runat="server">
<table border="1" cellpadding="4" cellspacing="0" style="font-size:12">
<tr>
<td>Question</td>
<td><b><asp:Label ID="lblSiteQuestion" runat="server" /></b></td>
</tr>
<tr>
<td>Answer</td>
<td><asp:Label ID="lblSiteAnswer" runat="server" /></td>
</tr>
</table>
</asp:Content>

<asp:Content ID="PageTitle" runat="server"
contentplaceholderid="PlaceHolderPageTitle" >
SharePoint Behind code implementation
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" runat="server"
contentplaceholderid="PlaceHolderPageTitleInTitleArea" >
When we want to implement behind code we need to register the same in GAC.
</asp:Content>

<asp:Content ID="Main" contentplaceholderid="PlaceHolderMain" runat="server">
<table border="1" cellpadding="4" cellspacing="0" style="font-size:12">
<tr>
<td>Question</td>
<td><b><asp:Label ID="lblSiteQuestion" runat="server" /></b></td>
</tr>
<tr>
<td>Answer</td>
<td><asp:Label ID="lblSiteAnswer" runat="server" /></td>
</tr>
</table>
</asp:Content>

<asp:Content ID="PageTitle" runat="server"
contentplaceholderid="PlaceHolderPageTitle" >
SharePoint Behind code implementation
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" runat="server"
contentplaceholderid="PlaceHolderPageTitleInTitleArea" >
When we want to implement behind code we need to register the same in GAC.
</asp:Content>




Note: - Do not try to compile the project in VS.NET IDE. You can only compile the class assembly. The ASPX file you need to later paste it to the '_layout' directory i.e. 'C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS'.
Once you have copied the ASPX file and registered the behind code assembly in GAC, you can run and enjoy how it looks like.