2011-11-13 24 views
1

我需要爲列表創建一個自定義EditForm.aspx(該列表可以有任何字段(包括自定義SPFields)我必須使用Visual Studio(和不是 SharePoint設計師)自定義EditForm.aspx與Visual Studio顯示列像往常一樣

Q 1)應用程序頁面將是一個正確的選項?

問2)我可以通過List.Fields集合獲得列表及其字段。但我不知道如何將這些字段添加到應用程序頁面中的面板?以下代碼不起作用,但可以澄清我想要的內容。

foreach (SPField fld in list.Fields) 
{ 
    this.pPanel.Controls(fld); 
} 

SharePoint的默認EditForm.aspx做我真正需要的。無論我們設置爲列(spfields)的字段在EditForm,DisplayForm和NewForm頁面中自動出現。我必須在自定義頁面上創建相同的功能。

回答

1

像開箱即用的EditForm.aspx一樣,在您的頁面上添加ListFormWebPart

<Module Name="CustomEdit" Url=""> 
    <File Url="CustomEditForm.aspx" Type="Ghostable"> 
     <AllUsersWebPart WebPartZoneID="Main" WebPartOrder="1"> 
     <![CDATA[ 
      <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"> 
      <Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly> 
      <TypeName>Microsoft.SharePoint.WebPartPages.ListFormWebPart</TypeName> 
      <PageType>PAGE_EDITFORM</PageType> 
      </WebPart>]]> 
     </AllUsersWebPart> 
    </File> 
</Module> 
相關問題