How To Change the Default EditForm, NewForm and DispForm


You’ve developed some custom new, edit and display application pages that are stored in the _layouts directory. Let’s assume the filenames are newform.aspx, dispform.aspx and editform.aspx. You now want to change the properties of your custom list so that any new, edit or display requests point to your custom pages.

If you open up your site within SharePoint Designer and expand the Lists folder, from there you can access the properties of that custom list by right clicking on it and selecting Properties. Once the List Properties pane is open, click on the Supporting Files tab.

You’ll see there that you can actually choose what display, edit and new forms you want your list to be using. So if you’ve developed something custom, you would click Browse…, point to your new location and select the file. Here is where it starts to fail, I am only able to browse within the site itself and cannot navigate to my _layouts directory to select the files I mentioned above.


I suspected this was a limitation of the SharePoint Designer UI and not actually a limitation of the Object Model. I did a bit of fiddling with my SPList object and was not able to find anything that let me change those properties. If you look at the screenshot above, there is a key piece of information that’ll make the light turn on (at least it did for me). The Supporting Files tab has a drop down selector for the Content type specific forms. If you think about that a moment, you’ll remember that ALL lists within SharePoint inherit from a default content type.

So armed with that knowledge, I created an SPContentType object and took a look at it’s properties and methods. Sure enough, there are 3 properties I can set to change these forms: EditFormUrl, NewFormUrl and DisplayFormUrl. Here is some sample code I used to change the forms for my custom list called ‘My List’ that inherits from the Item content type:

SPWeb web = SPContext.Current.Web;
web.AllowUnsafeUpdates = true;
SPList list = web.Lists["My List"];
SPContentType ct = list.ContentTypes["Item"];
ct.EditFormUrl = "_layouts/editform.aspx";
ct.NewFormUrl = "_layouts/newform.aspx";
ct.DisplayFormUrl = "_layouts/dispform.aspx";

So in the example code above, I had to determine what default content type my list inherited from. In this case it was the Item content type.

NOTE: If you need to change the content type directly, you can definitely do that, however, I did a bit of testing and found that any lists ALREADY inheriting from that content type did not pickup my changes to the form locations. Any NEW list that I created that was inheriting from that content type did pickup the changes. In order for me to change the form locations for the existing list I had to use the code above. For reference, here is how you would change the content type directly. The code has only a subtle difference.

SPWeb web = SPContext.Current.Web;
web.AllowUnsafeUpdates = true;
SPContentType ct = web.ContentTypes["Name Of Your Content Type"];
ct.EditFormUrl = "_layouts/editform.aspx";
ct.NewFormUrl = "_layouts/newform.aspx";
ct.DisplayFormUrl = "_layouts/dispform.aspx";

As always, any questions, let me know!


27 Responses to “How To Change the Default EditForm, NewForm and DispForm”

  1. matt March 29, 2011 at 5:57 am #


    Interesting post but i was wondering where those codes fit and what kind of project you need to build to deploy them. did you have to create a feature for that?

  2. shereen April 1, 2011 at 1:09 pm #

    Hi Matt,

    Actually, I don’t create any sort of project. I usually just put the files in the layouts directory in some sub folder and use a console app to redirect the edit, disp and new form urls. What part are you getting stuck on?

  3. Bruce July 22, 2011 at 1:12 pm #

    Actually, what I think Matt was asking, or at least what i want to ask, is “where do you put the software (what you call “sample code”) that you developed?”

  4. shereen July 22, 2011 at 3:48 pm #

    hey Bruce and matt. I’ve had a lot of feedback about this post, so let me write up a follow up on the weekend, and i’ll post it Monday that will clarify this, as well as some code for download. Would that help?

  5. Bruce July 25, 2011 at 4:10 am #

    Yes, indeed.

  6. shereen July 28, 2011 at 4:22 pm #

    Sorry all, running a bit behind this week, will get the post update done this weekend. half way there.

  7. piece of sharepoint September 19, 2011 at 12:48 pm #

    so no one has had a problem with this not working? because it’s not working for me. is there maybe a more awful work around? with sharepoint the more disgusting a solution looks the more likely it’s the one that works and i’ve wasted enough time exploring sensible dead ends in this thing. so if someone has something involving human sacrifice in order to change a simple default form setting, fire away

  8. shereen September 21, 2011 at 10:09 am #

    can you be more specific about what’s not working? I’d like to try and help but without some more details, it’ll be a bit tough. maybe drop me a line via email and we can see if we can sort out your challenges. are you working with sharepoint designer or building out the aspx pages in visual studio?

  9. shereen September 21, 2011 at 10:11 am #

    bruce, just a quick comment on this (new post isn’t done yet), in terms of ‘where’ to put the sample code files. I setup a console application in Visual Studio and just added a reference to the Microsoft.SharePoint.dll file. And then in Main, I added the code sample above.

    Does that help at all?

  10. Zaid October 3, 2011 at 12:15 am #


    I need to change the error form I want to display the errror in custom way.

    help me please.

  11. shereen October 4, 2011 at 6:32 am #

    Hi Zaid,

    Where are you trying to display the error? On your custom form?

  12. RichA February 3, 2012 at 2:56 pm #

    I may be misunderstanding what this site is meant for but I have a list, I think was created from a template and I wish to point the “Content type specific forms” to another folder or at least rename the name the point it points too.

  13. Tom February 8, 2012 at 3:29 pm #

    Actually, all you had to do was use that GUI you have in the screenshot, but you have to change the “Content type specific forms” dropdown from “Folder” to “Item” or it will not work and will always revert back to the default forms. But if you select “Item” it will save the paths to your new, custom forms.

  14. shereen February 8, 2012 at 4:33 pm #

    Hi Tom,

    As mentioned in my post, there is no way to browse to the _layouts directory and point to my custom forms. My forms are not created in SharePoint Designer but in Visual Studio and deployed to the _layouts directory. Hence the reason I wrote this post. SharePoint Designer created forms CAN use the GUI as you’d mentioned, and I’ve done that without issue in the past.

    If you know of a way to select Browse and choose a file in the layouts directory, please do let us know.

  15. Kenny Cao May 5, 2013 at 7:31 am #

    Hi shereen
    I have a problem with my custom form page – aspx page that is used for new form and edit form
    I have used querystring Parameter to recognize for editing or new item.
    But when I replace it to SPcontentype.NewForm and EditForm, my custom page has shown when I click “Add new item”, BUT it can not recognize the querystring because the current URL isn’t changed
    In my case, How can I solve it?
    Please help me.
    Thanks alot

  16. shereen May 5, 2013 at 7:27 pm #

    Hi Kenny,

    I’d like to help out but I got confused at this part: “my custom page has shown when I click “Add new item”, BUT it can not recognize the querystring because the current URL isn’t changed”. Are you able to clarify a bit more? So the new form loads, but you can’t read the querystring, is that the issue?

  17. John May 22, 2013 at 11:14 am #

    Thanks a lot for this. Saved me some time!

  18. Malay Vasavada May 2, 2014 at 11:08 am #


    I am using SharePoint 2010 and working on SharePoint list no on document library.

    I have done exactly same mentioned in above code and code works perfect. I have two content types on list. And I have set respective new,edit and display custom application page for both content types. All works well. However challenge is coming when I click on LinkTitle field value in the allitems.aspx view.

    When I select an item and click on view item from ECB menu or from ribbon, custom display form opens up for that content type which is perfect.

    However when I just click on the hyperlink of LinkTitle, it goes to allitems.aspx.

    Because I am using custom application page, I am using SharePoint:SaveButton to save the list item.

    Please let me know what needs to be done here. Any help or pointer would be highly appreciated.

  19. Naveen July 9, 2014 at 9:44 am #

    I found out that this functionality can be replicated adding the ‘FormUrls’ element in schema ( Which technique would be the preferred one?

  20. Shereen Qumsieh July 15, 2014 at 5:19 pm #

    Good question. I’d go the content type route if it’s your content type and you are provisioning it declaratively or programmatically yourself. If it’s an existing CT, might not be an option.

  21. Dave Stuart October 23, 2014 at 1:05 am #

    Thanks for posting this so long ago and keeping it available. This worked for me when I wanted to REPLACE the NewForm.aspx and EditForm.aspx pages with custome Application Pages. I added your code to my Feature in the OnActivate Method.

    Keep on Bloggin’

  22. Martyn White October 8, 2015 at 1:42 pm #

    Many Thanks for this – it’s exactly what I need to do – I need to update the edit form for the video content type in an asset library. My only problem is that I only have access to JS and JQ. ie client side scripting. No access to VS or servers (ms cloud environment and SPD is banned by our admins).

    Does anyone have a JS version of this please ? Thanks for any help you can give.

  23. shiv November 18, 2015 at 4:58 pm #

    I want to add j query or JavaScript in a list ‘DispForm’ with out using SharePoint designer.Could you please provide a location were it is saved.


  1. Links (5/17/2009) « Steve Pietrek – Everything SharePoint and Office - May 17, 2009

    […] How To Change the Default EditForm, NewForm and DispForm […]

  2. SharePoint 2010: Como crear formularios personalizados de lista (III)! « Pasión por la tecnología… - January 8, 2012

    […] Advertisement GA_googleAddAttr("AdOpt", "1"); GA_googleAddAttr("Origin", "other"); GA_googleAddAttr("theme_bg", "ffffff"); GA_googleAddAttr("theme_text", "000000"); GA_googleAddAttr("theme_link", "b54141"); GA_googleAddAttr("theme_border", "eeeeee"); GA_googleAddAttr("theme_url", "b54141"); GA_googleAddAttr("LangId", "19"); GA_googleAddAttr("Tag", "sharepoint-2010"); GA_googleAddAttr("Tag", "sharepoint-foundation-2010"); GA_googleFillSlot("wpcom_sharethrough"); Me gusta:Me gustaSé el primero en decir que te gusta esta post. Dejar un comentario […]

  3. SharePoint Designer Workflow Pause Until Date Change | SharePoint Fun - January 27, 2012

    […] from an event handler to some sort of custom workflow logic. In our case, since the forms were custom ASP.NET forms submitting programmatically to the list, it was easy enough for me to track any changes to the date received column, and if I do find that […]

  4. SharePoint 2013 - změna odkazu pro editaci ContentTypu - April 30, 2015

    […] […]

Leave a Reply