user576510
user576510

Reputation: 5905

Is using Script Manager necessary for using jquery in ASP.Net

I am using jquery with asp.net

I have installed hotfix for visual studio. Jquery works fine if I use script manager and refer jquery file in it. But it do not work if I exclude script manager. Is there no way I can exclude it. I am reffering jquery script and its vs file in link tags. plz advice.

<asp:ScriptManager runat=server ID=sman>
<Scripts>
<asp:ScriptReference Path="~/JavaScript/jquery-1.3.2-vsdoc2.js" />
</Scripts> 
</asp:ScriptManager>

Upvotes: 0

Views: 1300

Answers (2)

SLaks
SLaks

Reputation: 887469

You can reference jQuery using a normal <script src="..."></script> tag.

Upvotes: 1

Joel Etherton
Joel Etherton

Reputation: 37533

The way you're referencing it requires the script manager. That's basic XML just looking at the parent child relationship you've got. You don't need any of the stuff you've put there. Why use .Net to include a script reference unless you have some very complicated architecture and a need to minimize script downloads? Just include the script naturally as if it were an html page in the head of your page (or MasterPage if you're using them).

<script type="text/javascript" src="/JavaScript/jquery-1.3.2-vsdoc2.js"></script>

If your JavaScript directory is not at the root in this fashion you can use the VirtualPathUtility.ToAbsolute(path) class/method.

Upvotes: 1

Related Questions