Geeks With Blogs

News These postings are provided "AS IS" with no warranties, and confers no rights.
Locations of visitors to this page virtusa corp sharepoint virtusa.com shehan peruma
Shehan Peruma

I was creating a custom page layout for a publishing site and one of the requirements was to display the 'Created By' field. Piece of cake, I thought, all I need to do was to all add the following:

<SharePointWebControls:TextField FieldName="Created_x0020_By" runat="server"/>

However, this resulted in the field being rendered in the format- 'domain\username'. But on the 'View Properties' (DispForm.aspx) for the page the Created By field shown at the bottom of the page is in the correct format -'FirstName LastName'.

After some experimenting and researching this is the tag I had to use to get the correct format:

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


Note: the 'SharePoint' tag prefix for the above maps to:

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

 

Posted on Tuesday, December 23, 2008 4:13 AM MOSS , Customization | Back to top


Comments on this post: Change the format of the 'Created By' field in a page layout

# re: Change the format of the 'Created By' field in a page layout
Requesting Gravatar...
Hi, great post.
The only thing not working for me is that this control displays the author as a link. Do you know a way to show it as text only?
Thanks,
G
Left by gbelzile on Apr 03, 2009 6:12 PM

# re: Change the format of the 'Created By' field in a page layout
Requesting Gravatar...
what all parameters can go for FieldName="", other than "Author"
Left by ritesh on Oct 21, 2011 11:07 AM

# re: Change the format of the 'Created By' field in a page layout
Requesting Gravatar...
Thanks, this saved me a lot of time! I had the same requirement for my page layout.
Left by deugd on Aug 16, 2012 12:06 PM

Your comment:
 (will show your gravatar)


Copyright © shehan | Powered by: GeeksWithBlogs.net