Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have 1 solution (which is deploying as SandBox Solution).

I have added JavaScript files, Images, Application Page & UserControl in one Module under project folder.

I have one Element.xml file which has CustomAction button for Ribbon. Now in this I want to to add UserControl in this. So I have written,

"Control Id="ControlPageHeader" Sequence="400" ControlSrc="~/MyModuleName/MyTestFolder/MyUserControl.ascx"

And In UserControl, I have added the following line for my JavaScript file reference. "SharePoint:ScriptLink ID="ScriptLink1" runat="server" Localizable="false" LoadAfterUI="true" Name="/MyModule/JS/MyJScript.js">

When I create the package & Upload the solution on my site, Button is displayed in the Site, but when I click on the button, it does not take/do any action.

(Image is not displaying on the button also).

I don't know what is the problem ? Either the reference or path ?

Please help me for this.

share|improve this question
add comment

1 Answer

try the following in your ascx:

<SharePoint:ScriptLink ID="ScriptLink1" runat="server" Localizable="false" LoadAfterUI="true" Name="MyJScript.js"> 

sharepoint i think if memory servers me right will be looking in the 12hive folder of layouts under templates. If you want a folder than add it within the layouts folder

Templates/Layouts/MyModule/JS/MyJScript.js

<SharePoint:ScriptLink ID="ScriptLink1" runat="server" Localizable="false" LoadAfterUI="true" Name="/MyModule/JS/MyJScript.js"> 

somthing similar as to what iv said that you could reference:

http://stackoverflow.com/questions/5068663/how-to-call-an-external-javascript-file-from-a-webpart

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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