0

I created custom SharePoint New form with lots of custom code. So, when I load the form by clicking on New Item, it will open sometimes correctly and sometimes it gave error:

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.

But after one or two refresh its again working fine.

Please help me with this that how can I get the newform without abaove error in one go.

1 Answer 1

1

It is more than likely a syncronization issue. JS loads asyncronously is SharePoint. It is good to put Page_Load code within a function and call it using one of SharePoint's body onload functions; instead of using $(document).ready(function () { }); or $(function () { }); type operations on page load. Try one of these:

ExecuteOrDelayUntilScriptLoaded(yourFunction, "SP.JS");

or

_spBodyOnLoadFunctionNames.push("yourFunction");

There are core JS files used by SharePoint which need to be loaded first before any of your custom code will render properly. Make sure you are letting these files load before your custom functions. This should help.

3
  • I try this but the problem still exist I have to refresh the form 4 to 5 times to get the form displayed. otherwise it shows same error "Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator." Apr 13, 2018 at 5:54
  • Can you post your code please.
    – lazoDev
    Apr 13, 2018 at 10:40
  • That's what I said earlier the code is too lengthy, what I did is create around 700 radio custom fileds in newform and the value of these radio buttons are saved in 12 different Multiple line text box in sharepoint list. So, I want something that first load all the 700 created fields as this lead to webpart issue. I think I am clear now.. Apr 16, 2018 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.