【IT168技术文档】
第一步--修改表单页面默认模板:
用SPD打开要修改的页面(DispForm.aspx),找到ListFormWebPart,修改其TemplateName属性为CodeArt_NoticeTemplate,如下:
第二步--编写新模板:<TemplateName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">CodeArt_NoticeTemplate</TemplateName>
将一下的内容保存到12\TEMPLATE\CONTROLTEMPLATES\CodeArt_NoticeTemplate.ascx文件中:
<%@ Control Language="C#" AutoEventWireup="false" %> <%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="SharePoint" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebControls" %> <SharePoint:RenderingTemplate ID="CodeArt_NoticeTemplate" runat="server"> <Template> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="FormToolBar"> <SharePoint:InformationBar ID="InformationBar1" runat="server" /> <SharePoint:FormToolBar ID="FormToolBar1" runat="server" Visible="false" /> </td> </tr> </table> <table width="95%" border="0" cellspacing="8" cellpadding="0"> <tr> <td align="center" height="30px" class="title"> <b> <SharePoint:FormField ID="FormField1" runat="server" FieldName="Title" /> </b> </td> </tr> <tr> <td align="right"> <SharePoint:CreatedModifiedInfo ID="CreatedModifiedInfo1" runat="server" /> </td> </tr> <tr> <td height="1" align="center" class="seprow"> </td> </tr> <tr> <td valign="top" class="content"> <SharePoint:FormField ID="FormField2" runat="server" FieldName="Body" /> </td> </tr> <tr> <td> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> <table border="0" cellspacing="0" cellpadding="0"> <SharePoint:FormComponent ID="FormComponent1" TemplateName="AttachmentRows" runat="server" /> </table> <SharePoint:AttachmentUpload Visible="false" ID="AttachmentUpload1" runat="server" /> </td> </tr> </table> </td> </tr> <tr> <td> </td> </tr> <tr> <td align="center"> <table> <tr> <td> <SharePoint:GoBackButton ID="GoBackButton2" Visible="false" runat="server" /> <input type="button" value=' 返 回 ' onclick="javascript:CloseWindow();return false;" /> <!--img src="/_wpresources/DisForm/b_close.gif" onclick="javascript:IsCloseWindow();return false;" width="122" height="25"--> </td> </tr> </table> </td> </tr> <tr> <td align="center"> </td> </tr> </table> <script language="javascript"> function CloseWindow() { if( window.opener != null ) { self.close(); } else { history.back(-1); } } </script> </Template> </SharePoint:RenderingTemplate>