1

I'm trying to develop a couple of custom application pages for SharePoint 2010 that will be accessible from the central administration page as a part of my application, basically serving as a front end for my custom back end code. What I need is form-like functionality, some grid views, list boxes and all the usual stuff, but I want the preserve the native look and feel of SharePoint and am wondering what the fastest/best way to do this is without having to manually dissect the horror that are native SharePoint aspx pages.

So far, I've used Visual Studio 2010 to create pages with user controls by drag-and-dropping ASP.NET components into basic HTML layout (tables etc.) and I used SharePoint's CSS on top of it. This actually got me some decent looking results, but after checking out the actual .aspx files of native SharePoint pages, I realized that there's a lot more going on - everything is done using very mysterious code that looks something like this (this is a part of policy creation form, located in TEMPLATES\LAYOUTS\policyconfig.aspx):

<asp:Content contentplaceholderid="PlaceHolderTitleBreadcrumb" runat="server">
    <SharePoint:UIVersionedContent UIVersion="3" runat="server"><ContentTemplate>
        <asp:SiteMapPath
            SiteMapProvider="SPXmlContentMapProvider"
            id="ContentMap"
            SkipLinkText=""
            NodeStyle-CssClass="ms-sitemapdirectional"
            RootNodeStyle-CssClass="s4-die"
            PathSeparator="&#160;&gt; "
            PathSeparatorStyle-CssClass = "s4-bcsep"
            runat="server" />
    </ContentTemplate></SharePoint:UIVersionedContent>
...
<wssuc:InputFormSection
            id="NameAndDescription"
            Title="<%$Resources:dlcpolicy, policyedit_name_and_description%>"
            Description="<%$Resources:dlcpolicy, policyedit_name_and_description_long%>"
            runat="server">
        <Template_InputFormControls>
           <wssuc:InputFormControl runat="server" LabelText="<%$Resources:dlcpolicy, policyedit_policy_name%>">
            <Template_Control>
                <wssawc:InputFormTextBox title="<%$Resources:dlcpolicy, policyedit_policy_name%>" class="ms-input" ID="tbxName" Columns="35" Runat="server" MaxLength=255 />
                <wssawc:InputFormRequiredFieldValidator ControlToValidate="tbxName"
                    Display="Dynamic" ErrorMessage="<%$Resources:dlcpolicy, policyedit_name_empty_error%>" Runat="server" EnableClientScript="false"
                />
                ...

I fear my current way of doing things - using ASP.NET controls with CssClass properties to approximately re-create the SP look and feel - is likely going to sooner or later result in serious problems given just how different the approach used by SharePoint is. Note that I'm not using <SharePoint:*> tags in my own design.

Is there a fast way to take some existing SharePoint pages/forms, re-design them (i.e. use different label text etc.) without having to manually scan every single markup line, provide my own custom back-end code (e.g. I'd like to have a grid like in "Manage content databases" but with data bound from custom tables) and resource files, then deploy everything directly from Visual Studio? Should I consider SharePoint Designer for this?

  • 1
    I think you're using the correct approach already. Unfortunately, as far as I know, there are few shortcuts to styling SharePoint at all. You have to live with legacy html, sealed and obfuscated code, and a lack in use of standards. – Johannes Mar 17 '14 at 13:48
  • @Johannes I'm primarily worried that I'm not using tags like e.g. <SharePoint:SPLinkButton> in place of the usual <asp:LinkButton>. Also I'm not using things like <wssuc:ButtonSection>, but there seems to be no way to get this other than manually writing aspx myself... – w128 Mar 17 '14 at 14:02
1

Use the Application Page template in Visual Studio 2010. That should inherit from the master page and all the SharePoint look and feel should be there automatically.

When it creates that item in Visual Studio, you should have a lot of that markup already available in the page, no? Some people create Site Pages by creating an Application page, and then copying and pasting the markup into an empy site page aspx and removing the application page specific markup.

Are you are starting with a blank (empty) application page?

  • I am using the default Application Page, and the native look indeed is there. What confuses me is that SharePoint pages use a bunch of <SharePoint> and other tags that are simply not there when I work with normal ASP.NET controls. So although right now the end result looks pretty much the same, the actual aspx code behind is very different - and I'm not sure if this can lead to future problems, e.g. an update breaking the look, or browser version incompatibilities. – w128 Mar 17 '14 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.