Register/Include javascript within RenderingTemplate.

Posted by Janis Veinbergs on Stack Overflow See other posts from Stack Overflow or by Janis Veinbergs
Published on 2010-03-24T07:37:07Z Indexed on 2010/03/24 7:43 UTC
Read the original article Hit count: 331

Is it possible to register (include) javascript within RenderingTemplate? (RenderingTemplates are used to render list forms or fields) By using

<SharePoint:RenderingTemplate ID="NewRelatedListItem" runat="server">
  <Template>
    <span id="part1">
      <SharePoint:ScriptLink Name="SPFormFieldAssistant.js" Localizable="false" /> 
      ...
    </span>
    ...
  </Template>
</SharePoint:RenderingTemplate>

it couldn't be done - it didn't include script at HEAD area, but...:

Source

Is something wrong with my code? Althought script IS at Layouts folder and I checked with Reflector that it uses Layouts folder if Localizable='False'.

I don't want this script to be loaded with every page, but only for forms.

Any ideas on how this could be achieved?

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about rendering