SharePoint 2007:格式化FormField [英] SharePoint 2007: Formatting a FormField

查看:172
本文介绍了SharePoint 2007:格式化FormField的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为发布网站的SharePoint母版页的页脚显示页面所有者和最后修改日期。在我的主页上,我目前有:

I'm trying to display the page owner and last modified date on the footer of a SharePoint master page for a publishing site. On my master page I currently have:

<SharePoint:FormattedString FormatText="Page owner: {0} Last updated: {1:dd/MM/yyyy}" runat="server">
<SharePoint:FormField ControlMode="Display" FieldName="PublishingContact" DisableInputFieldLabel="true" runat="server"/>
<SharePoint:FormField ControlMode="Display" FieldName="Modified" DisableInputFieldLabel="true" runat="server" />
</SharePoint:FormattedString>

这很好,但是它不会修改日期格式:

This works great, however it doesn't modify the date format:


页面所有者:litwareinc\treesj最后更新:3/31/2009 10:32 PM

Page owner: litwareinc\treesj Last updated: 3/31/2009 10:32 PM

我猜这个日期是以字符串的形式返回的,所以dd / MM / yyyy的格式不会做任何事情。我意识到修改Web应用程序的区域设置可能会解决这个问题,但是我更感兴趣的是可以使用不同的默认格式来实现。

I'm guessing the date is returned as a string so the formatting of dd/MM/yyyy does nothing. I realize modifying the regional settings on the web application might fix this however I'm more interested in how this could be implemeneted with a different format to the default.

感谢提前!

Jonny

推荐答案

您是正确的 - FormField控件已经将输出渲染为字符串,因此将其包装在FormattedString中将不起作用。

You are correct - the FormField control has already rendered the output as a string so wrapping it inside FormattedString won't work.

替代 Nat 的答案是编写自己的控件并在其中包装FormFields。然后,您可以根据需要捕获渲染的输出和转换。

An alternative to Nat's answer is to write your own control and wrap the FormFields within that. You can then capture the rendered output and transform as you wish.

这篇关于SharePoint 2007:格式化FormField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆