{"id":1527,"date":"2013-04-01T12:41:43","date_gmt":"2013-04-01T10:41:43","guid":{"rendered":"http:\/\/www.itidea.nl\/?p=1527"},"modified":"2013-04-01T12:41:43","modified_gmt":"2013-04-01T10:41:43","slug":"how-to-show-column-properties-on-a-pagelayout","status":"publish","type":"post","link":"https:\/\/www.itidea.nl\/index.php\/how-to-show-column-properties-on-a-pagelayout\/","title":{"rendered":"How to show column properties on a pagelayout"},"content":{"rendered":"<p>When digging around in the SharePoint WebControls on showing some field properties on a pagelayout I found some interesting stuff.<\/p>\n<h3>FieldDescription<\/h3>\n<p>First of all I thought the SharePoint webcontrol &#8216;FieldDescription&#8217; would show the description of the field. At <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.webcontrols.fielddescription%28v=office.14%29.aspx\" target=\"_blank\">MSDN <\/a>the FieldDescription class was described as<\/p>\n<blockquote><p>&#8216;Represents the description metadata of a field.&#8217;<\/p><\/blockquote>\n<p>Any context is missing here.<br \/>\nAfter looking around a little bit more some context was found at the description of the Render method:<br \/>\nThis member overrides TemplateBasedControl.Render(HtmlTextWriter).<br \/>\nAh, so this webcontrol is used in template based controls. In the SharePoint root folder some references to this control were found in DefaultTemplates.ascx and SharePoint_Publishing_defaultformtemplates.ascx.<br \/>\nStubborn as I am I just put this control on a page layout to check if anything will be rendered, but nothing was.<\/p>\n<h3>FieldProperty<\/h3>\n<p>The FieldProperty control<\/p>\n<blockquote><p>&#8216;Represents a property of a field; that is, a column, on a list.&#8217;<\/p><\/blockquote>\n<p>This is what I&#8217;m actually looking for!<br \/>\nThe control is very easy to use:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;SharePointWebControls:FieldProperty FieldName=&quot;Title&quot; PropertyName=&quot;Required&quot; runat=&quot;server&quot; \/&gt;<\/pre>\n<p>The FieldName is the static (internal) field name and the PropertyName can any of the properties of a field.<br \/>\nThe FieldProperty control will return the values set in the UI or in XML, dependent on how the field is created.<\/p>\n<p>In the picture below the results are shown of the property values of three columns:<\/p>\n<ul>\n<li>SingleLineOfTextField: single line of text field, created in xml, not required, created in a group, ShowInNewForm set to TRUE.<\/li>\n<li>UICreated: single line of text field, manually created directly at list level, required<\/li>\n<li>UICreatedSiteColumn: single line of text field, manually created in the site columns gallery and added to the list, required and stored in a group<\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/04\/Blog-Column-properties-01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1528\" title=\"Column properties\" src=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/04\/Blog-Column-properties-01.png\" alt=\"\" width=\"513\" height=\"491\" srcset=\"https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/04\/Blog-Column-properties-01.png 513w, https:\/\/www.itidea.nl\/wp-content\/uploads\/2013\/04\/Blog-Column-properties-01-300x287.png 300w\" sizes=\"auto, (max-width: 513px) 100vw, 513px\" \/><\/a><\/p>\n<p>The value of the ShowInNewForm attribute isn&#8217;t returned, so probably not all <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms437580%28v=office.14%29.aspx\" target=\"_blank\">field elements<\/a> can be used.<\/p>\n<h3>Summary<\/h3>\n<p>The FieldProperty control can be used to show values of field properties on a page, but not all. In the above example the ShowInNewForm isn&#8217;t exactly useful to show on a page, but ok.<br \/>\nBe aware of the value of the description property returned: this is the value on the list, not the site columns itself.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When digging around in the SharePoint WebControls on showing some field properties on a pagelayout I found some interesting stuff. FieldDescription First of all I thought the SharePoint webcontrol &#8216;FieldDescription&#8217; would show the description of the field. At MSDN the &#8230; <a class=\"more-link\" href=\"https:\/\/www.itidea.nl\/index.php\/how-to-show-column-properties-on-a-pagelayout\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[20,42],"class_list":["post-1527","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2010","tag-c","tag-sharepoint-2010"],"_links":{"self":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/comments?post=1527"}],"version-history":[{"count":8,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1527\/revisions"}],"predecessor-version":[{"id":2457,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/posts\/1527\/revisions\/2457"}],"wp:attachment":[{"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/media?parent=1527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/categories?post=1527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itidea.nl\/index.php\/wp-json\/wp\/v2\/tags?post=1527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}