none
Changing DispForm.aspx to another page

    Question

  • When creating a new list using code, is there a way to change the default DispForm.aspx to another custom page?  Thanks in advance.
    • Moved by Lambert Qin [秦磊] Tuesday, August 26, 2008 2:16 AM programming issue (Moved from SharePoint - Design and Customization to SharePoint - Development and Programming)
    Friday, August 22, 2008 7:01 PM

Answers

  • The way to change from DispForm.aspx to a custom form is to add the custom form and then change the URL pointer to the custom form. The SPForm objects are read only using the object model.

    To change the pointer use SharePoint Designer.

    Expand the "Lists" folder and right click on the list name.  Go to Properties, Support Files and the three form URLs can be changed there.

     

    Friday, January 23, 2009 6:04 PM

All replies

  • Programming issue.

    Move to SharePoint - Development and Programming
    -lambert
    Posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, August 26, 2008 2:17 AM
  • They way I addressed this was to create a list template feature with a custom display form.  I don't exactly have it working yet but the approach may help someone else who was watching this thread.
    Wednesday, August 27, 2008 6:37 PM
  • I created the list template feature fine, using a Feature Generator I found on CodePlex.  However, everytime I try to create an instance of the list, I get the following error:

    Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))   at Microsoft.SharePoint.Library.SPRequestInternalClass.CreateListFromFormPost(String bstrUrl, String& pbstrGuid, String& pbstrNextUrl)
       at Microsoft.SharePoint.Library.SPRequest.CreateListFromFormPost(String bstrUrl, String& pbstrGuid, String& pbstrNextUrl)

    I have a fairly complex list template, with People and Group types, Lookups, Choice fields, Dates, Numbers, etc.  Also there are around custom fields in total.  When I use the Feature Generator to create a feature on another much smaller list it works just fine.

    Any thoughts are appreciated.  Thanks.
    Friday, August 29, 2008 1:59 PM
  • Well... using code... take a look to the SPList.Forms. This is where the list object has the 4 forms defined (each different Type).
    Using features... you're on the right way (you can also take a look to the VisualStudio Extensions, will help you to start with features, including listtemplates).

    When you're trying to do a complex one, I recommend you that you test it every few changes added... start with a simple one, test if works, then add something, test, add more, test... if you code a lot without testing, then you'll fight with generic errors like that that you never know where they're exactly generated.
    Friday, August 29, 2008 4:41 PM
  • The way to change from DispForm.aspx to a custom form is to add the custom form and then change the URL pointer to the custom form. The SPForm objects are read only using the object model.

    To change the pointer use SharePoint Designer.

    Expand the "Lists" folder and right click on the list name.  Go to Properties, Support Files and the three form URLs can be changed there.

     

    Friday, January 23, 2009 6:04 PM
  • I was aware of that.  I was trying to do it programmatically.  Perhaps in the next version of SharePoint they will allow manipulation of the form assignments.  What I ended up doing was creating a list, chaning the form in SP Designer, then creating a template of that list.  Then I create all new lists from that template and the new display form setting carries over.  Thanks for the responses.
    Friday, January 23, 2009 9:39 PM