最近在自定义DisForm.aspx页面时 发现 创建时间信息无法进行拆分,人事MM只想要修改时间,去掉创建人,创建时间和修改人。

于是我的重新研究下在SPD里面如何去拆分这个时间。

在详情页面上找到的时间信息是如下控件。(默认的DisForm页面没有,这里我是新建了一个列表显示页面)

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

其实就这个东东。但是在转换成html的时候会变成个table,所以我们要分析下里面有什么东西。

问了下其他人,列表的基本模板可以在C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES

的DefaultTemplates.ascx下找到具体对应的数据绑定,查找 CreatedModifiedInfo 大概在485行左右。

<SharePoint:RenderingTemplate id="CreatedModifiedInfo" runat="server">
<Template>
<table cellpadding="" cellspacing="">
<tr><td nowrap="nowrap" class="ms-descriptiontext" id="onetidinfoblock1">
<SharePoint:FormAuthorEditorFormattedString
UserOnlyFormatText="<%$Resources:wss,form_createdby_user%>"
AppOnlyFormatText="<%$Resources:wss,form_createdby_app%>"
UserAppFormatText="<%$Resources:wss,form_createdby_user_app%>"
IsAuthorField="true"
runat="server">
<SharePoint:FormField ControlMode="Display" FieldName="Created" DisableInputFieldLabel="true" runat="server"/>
<SharePoint:FormField ControlMode="Display" FieldName="Author" DisableInputFieldLabel="true" runat="server"/>
<SharePoint:CreationType runat="server"/>
<SharePoint:FormAppInfo ControlMode="Display" FieldName="AppAuthor" runat="server" />
</SharePoint:FormAuthorEditorFormattedString>
</td></tr>
<tr><td nowrap="nowrap" class="ms-descriptiontext" id="onetidinfoblock2">
<SharePoint:FormAuthorEditorFormattedString
UserOnlyFormatText="<%$Resources:wss,form_modifiedby_user%>"
AppOnlyFormatText="<%$Resources:wss,form_modifiedby_app%>"
UserAppFormatText="<%$Resources:wss,form_modifiedby_user_app%>"
IsAuthorField="false"
runat="server">
<SharePoint:FormField ControlMode="Display" FieldName="Modified" DisableInputFieldLabel="true" runat="server"/>
<SharePoint:FormField ControlMode="Display" FieldName="Editor" DisableInputFieldLabel="true" runat="server"/>
<SharePoint:FormAppInfo ControlMode="Display" FieldName="AppEditor" runat="server" />
</SharePoint:FormAuthorEditorFormattedString>
</td></tr>
</table>
</Template>
</SharePoint:RenderingTemplate>

这时,可以发现这个空间也是由许多数据绑定而成,例如

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

上面的代码是显示创建时间和创建人的。
我们回到原来的详细页面设计下。将

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

复制到需要显示的位置。

<tr>
<td width="190px" valign="top" class="ms-formlabel" style="display:none"> <H3 class="ms-standardheader">
<nobr>标题</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody" style="font-family:微软雅黑;font-weight:bolder;font-size:20px;text-align:center"> <xsl:value-of select="@Title"/>
</td>
</tr>
<tr>
<td colspan="" width="400px" valign="top" class="ms-formbody" style="font-family:微软雅黑;font-size:12px;text-align:center">
<SharePoint:FormField FieldName="Modified" runat="server" ControlMode="Display" DisableInputFieldLabel="true"/>
</td>
</tr>
<tr>
<td width="190px" valign="top" class="ms-formlabel" style="display:none"> <H3 class="ms-standardheader">
<nobr>Content</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody"> <xsl:value-of select="@Content" disable-output-escaping="yes"/> </td>
</tr>

具体显示的效果如下

搞定~

收工!

最新文章

  1. python des ecb 加密 demo
  2. C++ 11 lambda
  3. SOM自组织映射网络 教程
  4. 【git】删除某个文件的所有历史记录,批量删除远程分支
  5. web 模板 类似京东左侧的导航栏
  6. (转载)Android content provider基础与使用
  7. objective-c中使用cocoa的NSPredicate,谓词(十四)
  8. ASP.NET工具
  9. 基础总结篇之五:BroadcastReceiver应用具体解释
  10. Redis 密码设置和登录
  11. php的表单安全处理
  12. 我做的第一个程序(菜鸟的java课堂笔记)
  13. 关于MATLAB收集人工鼠标移动轨迹的坐标
  14. Linux学习之Centos(三)------系统文件目录及含义详解
  15. TCP/IP协议 数据链路层
  16. Ubuntu16.04下搭建Go语言环境
  17. [leetcode]449. Serialize and Deserialize BST序列化反序列化二叉搜索树(尽量紧凑)
  18. Python中的高级turtle(海龟)作图
  19. Homebrew 使用指南
  20. 23.如何查看一个keystore的具体签名信息

热门文章

  1. 分享一个很早之前写的小工具DtSpyPlus
  2. Uva 11354 LCA 倍增祖先
  3. Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) C
  4. 据说年薪30万的Android程序员必须知道的帖子
  5. python 学习笔记十七 django深入学习二 form,models
  6. android HAL 教程(含实例)
  7. 3.UIViewController详解
  8. Linux就该这么学
  9. 基础笔记10(IO 1.7try-with-resource) 装饰模式
  10. UML图