Author Field in a DataForm WebPart

7 Jun

The other day I was trying to access the Author field in a DataForm WebPart and noticed that it wasn’t listed in the Data Source Details taskpane.  If you are new to SharePoint, you recognize the Author field as the Created By column in a SharePoint list.  Created By is the display name while Author is the name used internal by SharePoint.  There are several great sites that list the display/common names for built-in SharePoint fields:

Link 1Link 2

If you look towards the bottom of your form, you will notice that SharePoint automatically takes care of displaying the Created/Created By and the Modified/Modified By information for you.

SharePoint automatically adds this information to the bottom of any form created.

SharePoint bundles this information into the following server control:

<SharePoint:CreatedModifiedInfo ControlMode="Display" runat="server"/>

Although convenient for SharePoint, it is not very convenient for the developer.  How else do you display the Created By field or Modified By?  Well, after some searches online, I discovered that this tag can be customized using templates which shouldn’t come as a surprise since it is an offspring of ASP.NET server controls.  It is through this customization that you can access the fields shown above in your DataForm WebPart.  After adding the CreatedModifiedInfo server control in the desired location, you need to add CustomTemplate tags, and add a FormField server control between those tags while setting the FieldName to the field you want using the internal name.  Below is some sample code:

<SharePoint:CreatedModifiedInfo ControlMode="Display" runat="server">
      <SharePoint:FormField FieldName="Author" runat="server" ControlMode="Display" DisableInputFieldLabel="true"/>


If you want to display the Modified field, you would replace Author with Editor since Editor is the internal name for Modified-remember to check out the links above to learn more about internal names.  Or if you want to display both fields, you can just add another FormField control on the page and style it any way you want by adding HTML code between the CustomTemplate tags.  One thing to keep in mind is that ControlMode needs to be set according to the type of form you are creating.  In my example, I am modifying a display form so ControlMode is set to Display.

One final note, you could modify the ASCX for CreatedModifiedInfo server code by modifying the templates stored on the SharePoint server.  Of course this is NOT RECOMMENDED, but if you are feeling courageous or curious, they are found under the following directory:


If anything, you will learn just how the control bundles the information you see by default.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: