Figure 10-23: New application page Customaspx created in the solution s folder hierarchy in Visual Studio .NET

Printing QR Code ISO/IEC18004 in Visual Studio .NET Figure 10-23: New application page Customaspx created in the solution s folder hierarchy
Figure 10-23: New application page Customaspx created in the solution s folder hierarchy
Encoding QR Code ISO/IEC18004 In Visual Studio .NET
Using Barcode maker for VS .NET Control to generate, create QR Code JIS X 0510 image in .NET applications.
10: SharePoint Pages
Scanning QR Code JIS X 0510 In Visual Studio .NET
Using Barcode decoder for .NET framework Control to read, scan read, scan image in .NET applications.
With this knowledge we can go ahead and complete our first application page We will build an application page that shows usage information for the current site collection First we need to add the HTML markup to the placeholders of the page that we saw in Table 10-1 Listing 10-5 shows the HTML markup
Print Bar Code In VS .NET
Using Barcode creator for .NET framework Control to generate, create barcode image in VS .NET applications.
Listing 10-5: The HTML Markup for the Application Page
Scan Bar Code In VS .NET
Using Barcode recognizer for Visual Studio .NET Control to read, scan read, scan image in .NET applications.
   
Quick Response Code Generator In C#.NET
Using Barcode printer for .NET framework Control to generate, create QR Code ISO/IEC18004 image in .NET framework applications.
                     
QR Code Maker In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create QR Code ISO/IEC18004 image in ASP.NET applications.
Customizing and Developing SharePoint Pages
QR Code Maker In VB.NET
Using Barcode printer for VS .NET Control to generate, create QR Code image in .NET framework applications.
          
Data Matrix 2d Barcode Maker In VS .NET
Using Barcode drawer for .NET Control to generate, create Data Matrix image in .NET applications.

Code 128A Creation In .NET
Using Barcode drawer for Visual Studio .NET Control to generate, create ANSI/AIM Code 128 image in Visual Studio .NET applications.
          
Barcode Drawer In Visual Studio .NET
Using Barcode creation for .NET framework Control to generate, create bar code image in VS .NET applications.
We didn t use the placeholder PlaceHolderAdditionalPageHead because we do not need to reference any style sheets or scripts In the placeholder PlaceHolderMain we create an HTML table showing the usage statistics for the site collection The table contains 6 rows, created using the <tr> elements with two cells per row created using the <td> element The first cell contains the description of the usage statistic and the second cell contains a label to store the actual statistic The title for the application page is added to the placeholder PlaceHolderPageTitle and the placeholder PlaceHolderPageTitleInTitleArea With the HTML designed we can go ahead and implement the code to assign values to the labels in the table Right click on the source view surface and select View Code in the context menu This will open the codebehind file, Customaspxcs, for the application page As we want to have the values shown in the table as soon as the page is loaded we will add the code shown in Listing 10-6 to the Page_Load event
Creating EAN / UCC - 13 In .NET Framework
Using Barcode generator for .NET framework Control to generate, create EAN / UCC - 14 image in VS .NET applications.
Listing 10-6: A Page_Load Event Handler That Assigns Values to the Labels in the HTML Table
ANSI/AIM ITF 25 Drawer In .NET
Using Barcode creation for .NET Control to generate, create ANSI/AIM I-2/5 image in .NET framework applications.
           
Bar Code Generation In Visual C#
Using Barcode creation for .NET Control to generate, create bar code image in .NET applications.
10: SharePoint Pages
Generating European Article Number 13 In Java
Using Barcode creator for Java Control to generate, create EAN-13 image in Java applications.
                     
Bar Code Recognizer In Java
Using Barcode decoder for Java Control to read, scan read, scan image in Java applications.
In the first line of the Page_Load event we obtain an SPSite object from the current SharePoint context SPContextCurrent (See 3, Introduction to the SharePoint Object Model, for more information on working with the SharePoint object model) In the second line we create a UsageInfo object that will provide us with the usage statistics for the site collection After this we set the values of the respective labels using usage information from the SharePoint site collection
Drawing Bar Code In .NET Framework
Using Barcode encoder for ASP.NET Control to generate, create bar code image in ASP.NET applications.
Why Don t We Need to Dispose the SPSite Object in This Sample
Bar Code Creation In Java
Using Barcode generator for Java Control to generate, create barcode image in Java applications.
According to SharePoint best practices, SPSite and SPWeb objects returned by SPContextSite, SPContextCurrentSite, SPContextWeb, and SPContextCurrentWeb should not be explicitly disposed by user code
Bar Code Creation In .NET Framework
Using Barcode drawer for ASP.NET Control to generate, create barcode image in ASP.NET applications.
With the code implemented we can now go ahead and debug the application page We can set the application page as the Startup item of the project This has the advantage that Visual Studio will browse to the page directly after hitting F5 Locate the Startup Item property in the Properties window for the project CustomApplicationPage and select Customaspx in the drop-down as shown in Figure 10-24 After that we can set a breakpoint in the first line of the Page_Load event and hit F5 Remember that application pages are deployed to the Layouts folder in the SharePoint hive and that Visual Studio creates a subfolder under the Layouts folder set to the name of the project Debug through the code and finally the application page Customaspx is rendered Figure 10-25 shows the rendered application page Don t forget that Visual Studio retracts the
Code39 Generator In Java
Using Barcode generation for Java Control to generate, create ANSI/AIM Code 39 image in Java applications.
Customizing and Developing SharePoint Pages
Encode Data Matrix ECC200 In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create Data Matrix ECC200 image in ASP.NET applications.
Figure 10-24: Setting Customaspx as the Startup Item of the project
solution after you have stopped debugging, so if you want to check the page after you have finished debugging you have to deploy it again by right clicking the project in the Solution Explorer and selecting Deploy in the context menu
Figure 10-25: Application page Customaspx in the browser
10: SharePoint Pages
Now that we have successfully built our first application page let s recap what we have done to create an application page We created an empty Visual Studio project and added an application page as a new item to the project Visual Studio creates mapped folders to mirror the structure in the SharePoint Layouts folder in the SharePoint hive As developers we need to design the layout of the application page through adding HTML markup to the Main placeholder of the ASPNET page (Visual Studio doesn t provide a visual designer for application pages) and implement the code in the code-behind aspxcs file We can then deploy and debug an application page by hitting F5