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:ScriptMana开发者_开发百科ger runat=server ID=sman>
<Scripts>
<asp:ScriptReference Path="~/JavaScript/jquery-1.3.2-vsdoc2.js" />
</Scripts>
</asp:ScriptManager>
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.
You can reference jQuery using a normal <script src="..."></script>
tag.
精彩评论