I’ve seen this topic covered indirectly and even unintentionally  in a number of posts, some of my favorite references include: “Using the SPPropertyBag with Custom Admin Pages in SharePoint” where Steve Graegert dedicates a section of the posting to talk about the “Page Structure”. Another is “Creating Custom Timer Jobs in Windows SharePoint Services 3.0” by Andrew Connell, in this one, the subject is not covered directly but the code provides a great example of how the controls can be used.

In this posting I’ll try to cover the subject directly using a basic application page and creating a very simple form.

We’ll start out with the application page; copy the following code and save it as an ASPX page in the SharePoint Layouts folder (usaually c:\program files\common files\microsoft shared\web server extensions\12\template\layouts\)

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c” %>

 
    Sample Application Page

 
    Sample Application Page


    This is a page provides an example of how to use the InputFormSection
    and InputFormControl control templates to create an application page
    that looks like the SharePoint OOTB Application Pages.

 

When accessing the page from the browser (i.e. http://siteurl/_layouts/pagename.aspx) should yield the following result:
 image

Add a “register” directive for each of the controls in the page as follows:

<%@ Register TagPrefix="wssuc" TagName="ButtonSection"
src=”~/_controltemplates/ButtonSection.ascx” %>

Next we’ll add a table to the “PlaceHolderMain” content place holder as follows. This table will be used to house our controls:


    This is a page provides an example of how to use the InputFormSection
    and InputFormControl control templates to create an application page
    that looks like the SharePoint OOTB Application Pages.

   
   

    

       

    

   

       

   

Insert the InputFormSection control to the table as follows:


    This is a page provides an example of how to use the InputFormSection
    and InputFormControl control templates to create an application page
    that looks like the SharePoint OOTB Application Pages.


   
   

    

       

    

   

        <wssuc:InputFormSection runat="server"
            Title=”Sample Form Section”
            Description=”This is a sample form section” >
       

       

   

This change should yield the following result:

image

Next we will add the “Template_InputFormControls” element, which will contain our actual form controls. This will be displayed in the right section of the form (the light blue section.) We will also add the “ButtonSection” control which we’ll use to house the buttons for our form. See the full code sample below:


<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>

<%@ Register TagPrefix="wssuc" TagName="ButtonSection"
src=”~/_controltemplates/ButtonSection.ascx” %>


    Sample Application Page


    Sample Application Page


    This is a page provides an example of how to use the InputFormSection
    and InputFormControl control templates to create an application page
    that looks like the SharePoint OOTB Application Pages.

   
   

    

       

    

   

        <wssuc:InputFormSection runat="server"
            Title=”Sample Form Section”
            Description=”This is a sample form section” >
           
              
           
       

        <wssuc:ButtonSection runat="server" TopButtons="true"
            BottomSpacing=”5″ ShowSectionLine=”false”>
           
                <asp:Button UseSubmitBehavior="false" runat="server"
                    class=”ms-ButtonHeightWidth” Text=”OK”
                    id=”BtnSubmitBottom” Enabled=”true”/>
           
       
       

   

The result should look as follows:

image

 

Advertisements