0

I've been bludgeoning my way through SOD, got it all working to a point however, some strange oddities.

If I create a page via the browser, add some script web parts with SOD in eg: SP.SOD.executeFunc('sp.js', null, populateListData); (I then have to hide all the menus and stuff using CSS which seems very hacky)

all works as expected.

If I add a new blank ASPX page in designer and do the same thing it does not and is littered with errors, basically cant get an SP.clientContext

Ive been searching loads of forums and things but there seems to be no one answer. Ive added in scriptlinks

<Sharepoint:ScriptLink runat="server" Name="SP.js" Localizable="false" ID="s1" LoadAfterUI="true"/> <Sharepoint:ScriptLink runat="server" Name="SP.Runtime.js" Localizable="false" ID="s2" LoadAfterUI="true"/>

but I think there must be more I need to add to the overall ASPX page to get this set up?

Is there any reference of exactly what needs to go where or has anybody come across this issue?

As a basic solution I want to have an aspx page with some HTML javascript, and load some data from various lists in Sharepoint

1 Answer 1

0

When you create a page using browser it uses proper Page Layout as well as Master Page. This will ensure all the js files and basic stuff are preloaded (sp.js etc)

When you add a blank aspx (or html etc) from SPD it creates a blank Page which has no connection to the Master Page or Page Layouts. Hence you need to setup all the references like sp.js etc.

2
  • Thanks, is there anyway to not use the masterpage layout then and just use the scripts? Is there any good reference for how to set this up? Or would it be better just to point it at a different master page perhaps without the usual headers and navigation on?
    – MPJ
    Commented Jul 25, 2016 at 14:33
  • You can add all the references. You can figure out by adding one by one.. as you receive error add those js files. Commented Jul 25, 2016 at 14:40

Your Answer

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

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