Quantcast
Channel: SharePoint – Be Awesome @
Viewing all articles
Browse latest Browse all 19

Using forms.css Classes on Application Pages

0
0

In building custom solutions, there are times when you need to create a custom page for entering data.  You still want the application page to be styled like the OOTB data entry forms.  This is all done with styles, so you open up a random form, do view source or launch the developer tools via F12, find the appropriate classes (ms.formtable and ms-formbody) and then add them to the appropriate controls on your page. 

The page still looks the same.  The styles did not take effect. 

The problem is that these classes are in the forms.css file and this is not loaded by default by the master page.  This css is loaded when the modal dialog is called and this makes it available on the forms.  If you launch the developers tools, you can see the list of css files loaded with the page. 

image

Forms.css is missing.  If you launch a modal dialog window from a page and then look at the css files, you can see more files were added including the forms.css.

image

So how can you get this css into your custom page?

In the PlaceHolderAdditionalPageHead, content block on your application page, insert the CSSRegistration control.

  1. <SharePoint:CssRegistration ID="formsCssRegistrationControl" Name="forms.css" runat="server" />

That’s it.  Now the css classes are available and your page can look just like the native SharePoint dialog pages.



Viewing all articles
Browse latest Browse all 19

Latest Images

Trending Articles





Latest Images