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();



}

  

你可能感兴趣的:(SharePoint)