This project has moved and is read-only. For the latest updates, please go here.

howto: reference script in visual web part

Jul 23, 2010 at 9:56 PM

I dont want to add the script to a document library.  I want to deploy it and jquery as application resources.  I do not have access to the master pages or the file system (beyond the wsp).  Does anyone have a working sample of markup that works this way.  I know how to create the wsp and the scripts DO get deployed to the proper place but they seem to be ignored.

Deployment location: {WebApplicationRoot}\Resources\Training\QT\jquery\ I have verified that after deployment and feature activation the files are in  C:\inetpub\wwwroot\wss\VirtualDirectories\80\resources\Training\QT\jquery\jquery-1.4.2.min.js <- if I reference this it works but I have a closed system.

<%@ Register assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<script src="~/resources/Training/QT/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () 
        alert("JQUERY WORKS!!");
Thanks in advance,
Jul 24, 2010 at 2:13 PM
Seems like an odd place to deploy the script files (overkill), but if they are there, then it's just a matter of getting the reference right in your script tag. I think the ~ is your problem. M.