今天,用到<SharePoint:RenderingTemplate ID="UserListForm" runat="server">这个摸板.
想记录下里面的两个主要控件
<SharePoint:ListFieldIterator runat="server"/>
<SharePoint:FormComponent TemplateName="AttachmentRows" runat="server"/>
<SharePoint:ListFieldIterator runat="server"/>是获取列表中所有的列表项.
<SharePoint:FormComponent TemplateName="AttachmentRows" runat="server"/>相当于加载摸板名为AttachmentRows的摸板.
- 用FormField来呈现某个字段,
- 用ListFieldIterator来呈现所有的字段.
代码如下:WFTaskUserControl.ascx
<SharePoint:RenderingTemplate runat="server" ID="MyEditFormTemplate">
<Template>
<SPAN id='part1'>
<wssuc:ToolBar CssClass="ms-toolbar" TemplateName="toolBarTbl" id="toolBarTbl2" RightButtonSeparator=" " runat="server">
<Template_Buttons>
<SharePoint:AttachmentButton ID="AttachmentButton1" runat="server"/>
<asp:PlaceHolder ID="FormFieldContext" runat="server"></asp:PlaceHolder>
</Template_Buttons>
</wssuc:ToolBar>
<TABLE class="ms-formtable" style="margin-top: 8px;" border=0 cellpadding=0 cellspacing=0 width=100%>
<SharePoint:ListFieldIterator ID="ListFieldIterator1" runat="server">
</SharePoint:ListFieldIterator>
<SharePoint:FormComponent ID="Attachments" TemplateName="AttachmentRows" runat="server"/>
</TABLE>
<table cellpadding=0 cellspacing=0 width=100%><tr><td class="ms-formline"><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></td></tr></table>
<TABLE cellpadding=0 cellspacing=0 width=100% style="padding-top: 7px"><tr><td width=100%>
<wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbl" RightButtonSeparator=" " runat="server">
<Template_Buttons>
<SharePoint:CreatedModifiedInfo ID="CreatedModifiedInfo1" runat="server"/>
</Template_Buttons>
</wssuc:ToolBar>
</td></tr></TABLE>
</SPAN>
<SharePoint:AttachmentUpload ID="AttachmentUpload1" runat="server"/>
</Template>
</SharePoint:RenderingTemplate>
<TABLE border=0 cellspacing=0 cellpadding=0 >
<wssuc:InputFormSection ID="taskHanderSection" Title="审批内容" Description="审阅该内容,如果内容可以修改,请输入您的内容。" runat="server">
<template_inputformcontrols>
<wssuc:InputFormControl LabelText="" runat="server">
<Template_Control>
<SharePoint:FormComponent ID="MyFormEdit" ControlMode="edit" runat="server">
</SharePoint:FormComponent>
</Template_Control>
</wssuc:InputFormControl>
</template_inputformcontrols>
</wssuc:InputFormSection>
<wssuc:InputFormSection ID="taskAdviceSection" Title="输入您的意见" Description="输入您对审批内容的意见。" runat="server">
<template_inputformcontrols>
<wssuc:InputFormControl LabelText="" runat="server">
<Template_Control>
<wssawc:InputFormTextBox RichText="false" class="ms-input" ID="Comments" runat="server" TextMode="MultiLine" Columns="100" Rows="10"/>
</Template_Control>
</wssuc:InputFormControl>
</template_inputformcontrols>
</wssuc:InputFormSection>
<wssuc:InputFormSection ID="taskAssignPersonSection" Title="权限指派给" Description="指定下一审批人员,这些人员将在您审批完成后进行审批。" runat="server">
<template_inputformcontrols>
<wssuc:InputFormControl LabelText="" runat="server" ID="AssignPersonControl">
<Template_Control>
<wssawc:PeopleEditor class="ms-input" AllowEmpty="true"
ValidatorEnabled="true" ID="AssignPerson"
runat="server"
SelectionSet="User,SecGroup,SPGroup"
width='300px' MultiSelect="true"/>
</Template_Control>
</wssuc:InputFormControl>
</template_inputformcontrols>
</wssuc:InputFormSection>
<wssuc:InputFormSection ID="taskMailNotifySection" runat="server" Description="您的审批结果将会以邮件的形式通知给指定人员。"
Title="邮件通知">
<template_inputformcontrols>
<wssuc:InputFormControl LabelText="" runat="server" ID="MailNotifyControl">
<Template_Control>
<asp:PlaceHolder ID="MailNotifyHolder" runat="server"></asp:PlaceHolder>
</Template_Control>
</wssuc:InputFormControl>
</template_inputformcontrols>
</wssuc:InputFormSection>
<wssuc:ButtonSection runat="server">
<Template_Buttons>
<asp:PlaceHolder ID="btnsSection" runat="server"></asp:PlaceHolder>
</Template_Buttons>
</wssuc:ButtonSection>
</TABLE>CS代码:
MyFormEdit.ItemContext = SPContext.GetContext(Context, workflow.ParentItem.ID, workflow.ParentList.ID, ElevatedSite);
MyFormEdit.ItemContext.FormContext.FormMode = SPControlMode.Edit ;
MyFormEdit.ItemContext.FormContext.SetFormMode(SPControlMode.Edit, true);MyFormEdit.Template = MyEditFormTemplate.Template;