Sunday, April 19, 2009

Use Linq inside a Script Block of an Application Page - SharePoint minimal configuration for Linq




style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">When
developing for SharePoint you maybe use Linq. Assume you are developing a new
piece of code and to href="http://mosshowto.blogspot.com/2008/10/improve-development-speed-sharepoint_1551.html">improve
your development speed
you have decided to test this code in an Application
Page inside a Script Block.


style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">Suddenly,
you want to use a Linq instruction but you remind that your page is called by a
web site of a new Web Application and this Web Application web.config has not
been modified to use .Net 3.5 new features.
Actually, at this point it is
very fast to activate the use of Linq.


    style="MARGIN-TOP: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; COLOR: gray; FONT-FAMILY: arial">
  1. style="MARGIN-TOP: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; COLOR: gray; FONT-FAMILY: arial; TEXT-ALIGN: justify">Modify
    your Application Page to have intellisense.

    You have two page
    directives to paste:

    the Assembly Page Directive to add a reference
    to the System.Core.dll (there is just one version of this dll the3.5
    version)


    style="FONT-SIZE: 9pt; BACKGROUND: yellow; FONT-FAMILY: 'Courier New'; mso-highlight: yellow; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000><% style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">@ lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> Assembly color=#000000> Name style="COLOR: blue">="System.Core, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=B77A5C561934E089"
    style="BACKGROUND: yellow; mso-highlight: yellow">%>
    lang=EN-US style="FONT-SIZE: 9pt; mso-ansi-language: EN-US"> prefix = o ns = "urn:schemas-microsoft-com:office:office"
    />



    the Import Page Directive to specify the
    System.Linq Namespace 


    style="FONT-SIZE: 9pt; BACKGROUND: yellow; FONT-FAMILY: 'Courier New'; mso-highlight: yellow; mso-no-proof: yes"> color=#000000><% style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">@ style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> color=#000000> Import color=#000000> Namespace style="COLOR: blue">="System.Linq" style="BACKGROUND: yellow; mso-highlight: yellow">%> lang=EN-US
    style="FONT-SIZE: 9pt; mso-ansi-language: EN-US">


    From
    this point you will have Linq Intellisense in your Visual Studio 2008
    Editor.






    So, you keep writing your code and obtain this
    page:




    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; BACKGROUND: yellow; FONT-FAMILY: 'Courier New'; mso-highlight: yellow; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000><% style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">@ lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> Page color=#000000> Language style="COLOR: blue">="C#" style="BACKGROUND: yellow; mso-highlight: yellow">%>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; BACKGROUND: yellow; FONT-FAMILY: 'Courier New'; mso-highlight: yellow; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> 


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; BACKGROUND: yellow; FONT-FAMILY: 'Courier New'; mso-highlight: yellow; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000><% style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">@ lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> Assembly color=#000000> Name style="COLOR: blue">="System.Core, Version=3.5.0.0, Culture=neutral,
    PublicKeyToken=B77A5C561934E089"
    style="BACKGROUND: yellow; mso-highlight: yellow">%>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; BACKGROUND: yellow; FONT-FAMILY: 'Courier New'; mso-highlight: yellow; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000><% style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">@ lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> Assembly color=#000000> Name style="COLOR: blue">="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
    PublicKeyToken=71e9bce111e9429c"
    style="BACKGROUND: yellow; mso-highlight: yellow">%>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; BACKGROUND: yellow; FONT-FAMILY: 'Courier New'; mso-highlight: yellow; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000><% style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">@ lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> Import color=#000000> Namespace style="COLOR: blue">="Microsoft.SharePoint" style="BACKGROUND: yellow; mso-highlight: yellow">%>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; BACKGROUND: yellow; FONT-FAMILY: 'Courier New'; mso-highlight: yellow; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000><% style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">@ lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> Import color=#000000> Namespace style="COLOR: blue">="System.Linq" style="BACKGROUND: yellow; mso-highlight: yellow">%>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">< lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">html
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> xmlns style="COLOR: blue">="http://www.w3.org/1999/xhtml">


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">< lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">head
    lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">   
    < style="COLOR: #a31515">title style="COLOR: blue">></ style="COLOR: #a31515">title style="COLOR: blue">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"></ lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">head
    lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">< lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">body
    lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">   
    < style="COLOR: #a31515">script style="COLOR: red">runat style="COLOR: blue">="server">


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes"> color=#000000>        style="COLOR: blue">void Page_Load( style="COLOR: blue">object sender, style="COLOR: #2b91af">EventArgs
    e)


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> style="mso-spacerun: yes">       
    {


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes"> color=#000000>           
    SPListCollection color=#000000> myListCollection = style="COLOR: #2b91af">SPContext color=#000000>.Current.Web.Lists;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes"> color=#000000>           
    var
    listQuery =
    from
    SPList aList
    in
    myListCollection
    where color=#000000> (aList.Title) == style="COLOR: #a31515">"Customers" style="COLOR: blue">select
    aList;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> 


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes"> color=#000000>           
    if
    (listQuery.Count() > 0)


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> style="mso-spacerun: yes">           
    {


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> style="mso-spacerun: yes">               
    Response.Write(
    "<br>How many
    Customers ? <br>"
    +
    listQuery.ElementAt<
    SPList color=#000000>>(0).ItemCount);


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> style="mso-spacerun: yes">           
    }


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes"> color=#000000>           
    else


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000> style="mso-spacerun: yes">           
    {


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>    
    style="mso-spacerun: yes">           Response.Write(
    style="COLOR: #a31515">"<br>" + style="COLOR: #a31515">"There is no list with this name" color=#000000>);


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">           
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">}


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> color=#000000> style="mso-spacerun: yes">       
    } 


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> style="mso-spacerun: yes">   
    </ style="COLOR: #a31515">script style="COLOR: blue">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"></ style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">body style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"></ style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">html style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">>


    style="FONT-SIZE: 9pt"> color=#000000> 



     But if you try to
    execute the page you will get a compilation Exception from SharePoint.









  2. style="MARGIN-TOP: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; COLOR: gray; FONT-FAMILY: arial; TEXT-ALIGN: justify">Modify
    your web.config

    To fix the Linq compilation issue open your Web
    Application web.config and paste this xml code just under the ending Tag of
    System.Web.



    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">    </ lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">webParts
    lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">    < lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">machineKey
    lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">validationKey lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>" style="COLOR: blue">E150B1AD042FFFD037943E670D1ED5EE50FCA3A12F8782BE color=#000000>" style="COLOR: red">decryptionKey= color=#000000>" style="COLOR: blue">F3790C833070BFBE30590B9CC6380A0592DF229F0DA7E3E7 color=#000000>" style="COLOR: red">validation= color=#000000>"SHA1 color=#000000>"
    />


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">    < lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">sessionState
    lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">mode lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>"SQLServer color=#000000>" style="COLOR: red">timeout= color=#000000>"60 color=#000000>" style="COLOR: red">allowCustomSqlDatabase style="COLOR: blue">=" style="COLOR: blue">true" style="COLOR: blue"> style="COLOR: red">partitionResolverType style="COLOR: blue">=" style="COLOR: blue">Microsoft.Office.Server.Administration.SqlSessionStateResolver,
    Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral,
    PublicKeyToken=71e9bce111e9429c
    " style="COLOR: blue"> />


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">  </ style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">system.web lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">  <!-- style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">Start
    adding Linq Compilation Instruction - Marc
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">-->


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">  < style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">system.codedom lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">    < lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">compilers
    lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">     
    <
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">compiler lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">language lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>"c#;cs;csharp color=#000000>" style="COLOR: red">extension= color=#000000>".cs color=#000000>" style="COLOR: red">warningLevel= color=#000000>"4 color=#000000>"


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">               
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">type lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>" style="COLOR: blue">Microsoft.CSharp.CSharpCodeProvider, System,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    color=#000000>" style="COLOR: blue">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">       
    <
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">providerOption lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">name lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>"CompilerVersion color=#000000>" style="COLOR: red">value= color=#000000>"v3.5 color=#000000>" style="COLOR: blue">/>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">       
    <
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">providerOption lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">name lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>"WarnAsError color=#000000>" style="COLOR: red">value= color=#000000>"false color=#000000>" style="COLOR: blue">/>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">     
    </
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">compiler lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">     
    <
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">compiler lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">language lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>" style="COLOR: blue">vb;vbs;visualbasic;vbscript color=#000000>" style="COLOR: red">extension= color=#000000>".vb color=#000000>" style="COLOR: red">warningLevel= color=#000000>"4 color=#000000>"


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">               
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">type lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>" style="COLOR: blue">Microsoft.VisualBasic.VBCodeProvider, System,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    color=#000000>" style="COLOR: blue">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">       
    <
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">providerOption lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">name lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>"CompilerVersion color=#000000>" style="COLOR: red">value= color=#000000>"v3.5 color=#000000>" style="COLOR: blue">/>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">       
    <
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">providerOption lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">name lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>"OptionInfer color=#000000>" style="COLOR: red">value= color=#000000>"true color=#000000>" style="COLOR: blue">/>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">       
    <
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">providerOption lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">name lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>"WarnAsError color=#000000>" style="COLOR: red">value= color=#000000>"false color=#000000>" style="COLOR: blue">/>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">     
    </
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">compiler lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">    </ lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">compilers
    lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">  </ style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">system.codedom lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">  <!-- style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">End
    adding Linq Compilation Instruction - Marc
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">-->


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">  < style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">runtime lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left> style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">    < lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">assemblyBinding
    lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">
    style="FONT-SIZE: 9pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">xmlns lang=EN-US
    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">=
    lang=EN-US
    style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> color=#000000>" style="COLOR: blue">urn:schemas-microsoft-com:asm.v1 color=#000000>" style="COLOR: blue">>


    style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">      style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">< style="FONT-SIZE: 9pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">dependentAssembly style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">> style="FONT-SIZE: 9pt">



    And you're
    done!







Saturday, April 18, 2009

Adding Breadcrumb Navigation for SharePoint Application Pages Programmatically





style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">When
creating a new Application Page (an .aspx page deployed to the c:\program
files\common files\microsoft shared\web server extensions\12\template\layouts
directory) you can easily manually fill the content place holder provided by
the application.master in order to obtain a page that seems really to be an Out
of The Box SharePoint Application Page.

Page Title (Browser Page
Title)

<style="COLOR: #a31515">asp:style="COLOR: #a31515">Content IDstyle="COLOR: blue">="Content4" style="COLOR: red">ContentPlaceHolderIDstyle="COLOR: blue">=style="COLOR: blue">"PlaceHolderPageTitle" style="COLOR: red">runat=style="COLOR: blue">"server"style="COLOR: blue">>
    style="COLOR: blue"><style="COLOR: #a31515">SharePoint:style="COLOR: #a31515">EncodedLiteral style="COLOR: red">ID=style="COLOR: blue">"EncodedLiteral2" style="COLOR: red">runat=style="COLOR: blue">"server" Textstyle="COLOR: blue">="Delete Items"
EncodeMethodstyle="COLOR: blue">='HtmlEncode' style="COLOR: blue">/>
</style="COLOR: #a31515">asp:style="COLOR: #a31515">Contentstyle="COLOR: blue">>

Page Title (Displayed in th
Application Page)

<style="COLOR: #a31515">asp:style="COLOR: #a31515">Content IDstyle="COLOR: blue">="Content3" style="COLOR: red">ContentPlaceHolderIDstyle="COLOR: blue">=style="COLOR: blue">"PlaceHolderPageTitleInTitleArea" style="COLOR: red">runat=style="COLOR: blue">"server"style="COLOR: blue">>
    style="COLOR: blue"><style="COLOR: #a31515">SharePoint:style="COLOR: #a31515">EncodedLiteral style="COLOR: red">ID=style="COLOR: blue">"EncodedLiteral1" style="COLOR: red">runat=style="COLOR: blue">"server" Textstyle="COLOR: blue">="Delete Items from a
Custom List"
EncodeMethodstyle="COLOR: blue">='HtmlEncode' style="COLOR: blue">/>
</style="COLOR: #a31515">asp:style="COLOR: #a31515">Contentstyle="COLOR: blue">>

Page Description (Displayed in th
Application Page)

<style="COLOR: #a31515">asp:style="COLOR: #a31515">Content IDstyle="COLOR: blue">="Content2" style="COLOR: red">ContentPlaceHolderIDstyle="COLOR: blue">=style="COLOR: blue">"PlaceHolderPageDescription" style="COLOR: red">runat=style="COLOR: blue">"server"style="COLOR: blue">>
    style="COLOR: blue"><style="COLOR: #a31515">SharePoint:style="COLOR: #a31515">EncodedLiteral style="COLOR: red">ID=style="COLOR: blue">"EncodedLiteral3" style="COLOR: red">runat=style="COLOR: blue">"server" Textstyle="COLOR: blue">="Use this page to delete
items from a Custom List"
style="COLOR: red">EncodeMethod=style="COLOR: blue">'HtmlEncode' style="COLOR: blue">/>
</style="COLOR: #a31515">asp:style="COLOR: #a31515">Contentstyle="COLOR: blue">>

The above code sample will produce the
following result:







style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">There
is one thing that you cannot perform manually using Content Place Holder, it is the
Breadcrumb Navigation.


style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">You
have two ways of adding Breadcrumb Navigation for SharePoint Application
Pages:



  1. style="MARGIN-TOP: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; COLOR: gray; FONT-FAMILY: arial; TEXT-ALIGN: justify">Adding
    a siteMapNode element in the layouts.sitemap
    href="http://weblogs.asp.net/members/jantie.aspx">Jan Tielens has
    written several posts on that topic. The exposed several approaches use xml
    files and deployment techniques in order to make your custom Application Page to
    be known by SharePoint as one of its native Application Pages. Doing that allows
    the native SharePoint breadcrumb generating mechanism to place automatically a
    Breadcrumb in your custom Application Page.

  2. style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">For
    more information you can visit:


    href="http://weblogs.asp.net/jan/archive/2007/09/10/adding-breadcrumb-navigation-for-sharepoint-application-pages.aspx">Adding
    Breadcrumb Navigation for SharePoint Application Pages



    href="http://weblogs.asp.net/jan/archive/2008/04/16/adding-breadcrumb-navigation-to-sharepoint-application-pages-the-easy-way.aspx">Adding
    Breadcrumb Navigation to SharePoint Application Pages, the Easy Way



    href="http://weblogs.asp.net/jan/archive/2008/10/10/adding-breadcrumb-navigation-to-application-pages-in-sharepoint-central-administration.aspx">Adding
    Breadcrumb Navigation to Application Pages in SharePoint Central
    Administration



  3. style="MARGIN-TOP: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; COLOR: gray; FONT-FAMILY: arial; TEXT-ALIGN: justify">Adding
    Breadcrumb Programmatically

  4. style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">This
    approach uses server-side code (C# or VB .Net). It is the opposite approach compared to Jan's one because we will customize SharePoint only at the page level.



    style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">Pros:
    Your
    SharePoint customizations of the Application Page stay at the level of the
    page, so you can deploy all using a single Feature.
    You can build your own
    navigation (SiteCollection Root Web > Web Site1 >..> Web Site
    n,  Web Site n > List, Web Site n > Doc Lib,
    etc.) 

    Cons:
    You have to decide about what navigation you
    want.
    You have to build the navigation using C# or VB .Net.
    You might
    have to put parameters in the URL when calling the page (List ID, Doc Lib ID,
    Page Name,etc.) if you do not use a href="http://msdn.microsoft.com/en-us/library/ms460194.aspx">CustomAction
    Element
     to call the Application Page.



style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">In
the following code sample I will programmatically, using C#, add a breadcrumb to an Application Page called by a new entry in the Action Menu of a list.

So, with this
UrlAction
:


style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">style="COLOR: blue"><UrlAction
Url=style="COLOR: black">"~site/_layouts/custom
directory/myCustomApplicationPage.aspx?id={ListId}
style="COLOR: black">"/>


style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">style="COLOR: blue"> 


style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">The
steps are the followings:


  • style="MARGIN-TOP: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; COLOR: gray; FONT-FAMILY: arial; TEXT-ALIGN: justify">At
    the first Load of the page 


    Getting the Breadcrumb element(s) from URL and/or
    SPContext 
    Storing some of the elements in an Hidden Control for the
    PostBack of the page.

  • style="MARGIN-TOP: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; COLOR: gray; FONT-FAMILY: arial; TEXT-ALIGN: justify">For
    the Postback
    Getting the
    Breadcrumb element(s) from the Hidden Control.

  • style="MARGIN-TOP: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; COLOR: gray; FONT-FAMILY: arial; TEXT-ALIGN: justify">In
    any case
    Building the Breadcrumb
    HTML
    Override the RenderChildren method of the Application page to fill the
    PlaceHolderTitleBreadcrumb with the Breadcrumb HTML 
  • size=2>



    The following code sample shows how to perform these operations using C#:




    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">   
    <style="COLOR: #a31515">asp:style="COLOR: #a31515">Content style="COLOR: red">ID="Content1"color=#000000> ContentPlaceHolderIDstyle="COLOR: blue">="PlaceHolderMain" style="COLOR: red">runatstyle="COLOR: blue">="server">"urn:schemas-microsoft-com:office:office" />


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>        style="COLOR: blue"><brcolor=#000000> style="COLOR: blue">/>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>        style="COLOR: blue"><brcolor=#000000> style="COLOR: blue">/>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>        style="COLOR: blue"><aspstyle="COLOR: blue">:Labelcolor=#000000> IDstyle="COLOR: blue">="lblItemsToDeleteList"
    runatstyle="COLOR: blue">="server"></style="COLOR: #a31515">asp:style="COLOR: #a31515">Labelstyle="COLOR: blue">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>        style="COLOR: blue"><brcolor=#000000> style="COLOR: blue">/>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>        style="COLOR: blue"><brcolor=#000000> style="COLOR: blue">/>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>        style="COLOR: blue"><inputcolor=#000000> typestyle="COLOR: blue">="hidden" style="COLOR: red">runat="server"color=#000000> idstyle="COLOR: blue">="listid" style="COLOR: blue">/>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">   
    </style="COLOR: #a31515">asp:style="COLOR: #a31515">Contentstyle="COLOR: blue">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> 


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">   
    <style="COLOR: #a31515">script style="COLOR: red">runatstyle="COLOR: blue">="server">


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">color=#000000>        string
    breadcrumbListLink =
    stringcolor=#000000>.Empty;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"> style="mso-spacerun: yes">color=#000000>        style="COLOR: blue">string breadcrumbWebLink =
    stringcolor=#000000>.Empty;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>        style="COLOR: blue">string listUrl = style="COLOR: blue">stringcolor=#000000>.Empty;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>        style="COLOR: #2b91af">SPList aList = style="COLOR: blue">nullcolor=#000000>;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>        style="COLOR: blue">public style="COLOR: blue">void Page_Load(style="COLOR: blue">object sender, style="COLOR: #2b91af">EventArgs
    e)


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">       
    {


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>           
    if
    (IsPostBack)


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">           
    {


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>               
    //provisioning bread
    crumb


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>               
    using
    (
    SPWeb myWeb =
    SPContextcolor=#000000>.Current.Web)


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">               
    {


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000> 


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>                   
    //get the list ID stored before
    Postback


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">                   
    aList = myWeb.Lists[
    newcolor=#000000> Guidcolor=#000000>(listid.Value)];


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">                   
    listUrl = Microsoft.SharePoint.Utilities.
    style="COLOR: #2b91af">SPUrlUtilitycolor=#000000>.CombineUrl(myWeb.Url,
    aList.RootFolder.Url);


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>                   
    //server side step to provision the
    bread crumb.


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">                   
    breadcrumbWebLink =
    "<a
    href='"
    + myWeb.Url + style="COLOR: #a31515">"'>" + myWeb.Title +
    "</a>"color=#000000>;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">                   
    breadcrumbListLink =
    "<a
    href='"
    + listUrl + style="COLOR: #a31515">"'>" + aList.Title +
    "</a>"color=#000000>;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">               
    }


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>               
    returncolor=#000000>;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">           
    }


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000> 


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>           
    using
    (
    SPWeb myWeb =
    SPContextcolor=#000000>.Current.Web)


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">           
    {


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>               
    try


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">               
    {


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">                   
    aList = myWeb.Lists[
    newcolor=#000000> Guidcolor=#000000>(Request.QueryString[style="COLOR: #a31515">"id"color=#000000>])];


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000> 


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>                   
    //provisioning bread
    crumb


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">                   
    listUrl = SPUrlUtility.CombineUrl(myWeb.Url,
    aList.RootFolder.Url);


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">                   
    breadcrumbWebLink =
    "<a
    href='"
    + myWeb.Url + style="COLOR: #a31515">"'>" + myWeb.Title +
    "</a>"color=#000000>;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">                   
    breadcrumbListLink =
    "<a
    href='"
    + listUrl + style="COLOR: #a31515">"'>" + aList.Title +
    "</a>"color=#000000>;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000> 


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>                   
    //storing the list ID to be retrieved
    after Postback in order to build bread crumb.


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">                   
    listid.Value = aList.ID.ToString();


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">               
    }


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>               
    catch


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">               
    {


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">                   
    lblItemsToDeleteList.Text =
    "The list
    does not exist. Check that the page URL is correct and has not been manually
    modified."
    ;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>                   
    returncolor=#000000>;


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">           
    style="mso-spacerun: yes">    }


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">           
    }


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">       
    }


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000> 


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>        style="COLOR: blue">protected style="COLOR: blue">override style="COLOR: blue">void RenderChildren(style="COLOR: #2b91af">HtmlTextWriter
    output)


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">       
    {


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>           
    LiteralControlcolor=#000000> myBreadcrumb = newcolor=#000000> LiteralControlcolor=#000000>(breadcrumbWebLink + " >
    "
    + breadcrumbListLink);


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">           
    Master.FindControl(
    style="COLOR: #a31515">"PlaceHolderTitleBreadcrumb"color=#000000>).FindControl(style="COLOR: #a31515">"ContentMap"color=#000000>).Controls.Add(myBreadcrumb);


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes">style="mso-spacerun: yes">color=#000000>           
    style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">basestyle="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">color=#000000>.RenderChildren(output);


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">color=#000000>style="mso-spacerun: yes">       
    }


    style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">style="mso-spacerun: yes">   
    </style="COLOR: #a31515">scriptstyle="COLOR: blue">>


    style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
    align=left>style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">style="COLOR: blue"> 







    style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 10pt; PADDING-BOTTOM: 5px; MARGIN: 1px 0px; COLOR: gray; PADDING-TOP: 5px; FONT-FAMILY: arial; TEXT-ALIGN: justify">I have posted the complete page example in CodePlex :




    href="http://customlistitemsdel.codeplex.com/">SharePoint Delete Items of Custom
    Lists



     

    Sunday, April 12, 2009

    SharePoint List Template Id’s















    The following table lists values for the default list template types. Thanks to Simeon Lobo and Smashou I have coded this sortable table of list templates types in a few minutes, and am still amazed by until where you can go in customizing Blogger.




    MSDN Reference: ListTemplate Element (List Template)















































































































































































    Value Description

    1200

    Administrator tasks list

    104

    Announcements list

    303

    Blog Categories list

    302

    Blog Comments list

    301

    Blog Posts list

    105

    Contacts list

    120

    Custom grid for a list

    118

    Custom Workflow Process

    130

    Data Connection library

    110

    Data sources

    108

    Discussion board

    101

    Document library

    106

    Events list

    150

    Gantt Tasks list

    100

    Generic list

    1100

    Issue tracking

    103

    Links list

    114

    List template gallery

    116

    Master pages gallery

    201

    Meeting Agenda list

    202

    Meeting Attendees list

    204

    Meeting Decisions list

    207

    Meeting Objectives list

    200

    Meeting Series list

    210

    Meeting text box

    211

    Meeting Things To Bring list

    212

    Meeting Workspace Pages list

    117

    No-Code Workflows

    2002

    Personal document library

    109

    Picture library

    300

    Portal Sites list

    2003

    Private document library

    111

    Site template gallery

    102

    Survey

    107

    Tasks list

    112

    User Information list

    113

    Web Part gallery

    119

    Wiki Page library

    140

    Workflow History

    115

    XML Form library