how to create a custom form for sharepoint list

在VS中创建一个applicationPage映射到Layouts文件夹下,然后代码如下:

SPList lstTest = web.Lists["Shared Documents"];

string newUrl = string.Format("layouts/NewEditForm.aspx", web.ServerRelativeUrl, lstTest.RootFolder.Url);

var form = web.GetFile(newUrl);

if (form != null && form.Exists)

{

 //string newFomrUrl = lstTest.DefaultEditFormUrl.Replace("EditForm.aspx", "docEditForm.aspx");

  lstTest.DefaultEditFormUrl = newUrl;

  lstTest.Update();

}

  

原文地址:https://www.cnblogs.com/olay/p/3177063.html