Dec 16, 2013

SharePoint 2010 Search show default display form instead of custom display form

I had a problem where SharePoint Foundation 2010 Search was returning the DispForm.aspx in the search results instead of the CustomForm.aspx that was configured as the default display form.

Solutions (I like option 3 best):
  1. Configure the search engine, but with Foundation Search, there's hardly anything to configure.  
  2. Eliminate or hide the DispForm.aspx, but I learned in SharePoint 2007 that doing anything drastic to the default DispForm.aspx can break a list in strange, un-repairable ways.
  3. Use the following JavaScript redirect in a content editor webpart in the DispForm.aspx:
    <script type="text/javascript">
    function redirectForm() {
    var pagemode = GetUrlKeyValue('DisplayMode', false);
    if(pagemode == null || pagemode == "")
             var hrefCurrent = window.location.href;
             var hrefNew = hrefCurrent.replace("DispForm.aspx","CustomForm.aspx");    
        window.location.href = hrefNew;
    ExecuteOrDelayUntilScriptLoaded(redirectForm, "sp.js");</script>


  1. THANK YOU! It worked perfectly.

  2. I am a sharepoint admin for our sharepoint site in my project. The sharepoint version our project use is 2007.
    Suddenly, an issue started arising where in the layout or the view of pages started coming wrong.
    When we directly try to open a record then it opens with a wrong view and if we try to use edit option then it throws an error:

    The file or folder name contains characters that are not permitted. Please use a different name.

    Troubleshoot issues with Microsoft SharePoint Foundation.

    Correlation ID: 5c1801a5-fc47-4758-b088-30ef7dcb5e09

    Date and Time: 30/05/2019 06:56:21

    However, if we go to the same page and if we just hover the mouse over any record then we can see things like view item, edit item, etc. From here if we are clicking on view item then the page appears correctly and we are able to edit the pages as well.
    This issue has occurred to all the pages which were created using the same list.
    I tried to change the view of the list. I created a similar kind of view and I changed the default view of the list to this new view. Then if I am opening the list, the records are getting opened correctly. However, the pages created using the list is not coming correctly.
    I also tried to republish the page using Infopath in the correct layout but it also didnt worked.

    Can you please help to understand that what can be the possible cause for this and how can we resolve this issue.

    Please let me know if any information is needed from my side.