itsbalur
itsbalur

Reputation: 1002

Refer Jquery in ASP.Net master page

I am using the Jquery library, and I understand the suggested approach is to reference it at the bottom of web page, within the <body> tag & not withing the <head> tag. But when using MasterPages with ASP.net, if I include the Jquery library at the bottom of the MasterPage, then my individual script files included in .aspx files won't work because, Jquery library will not be loaded by then.

What is the best approach to include Jquery library while using MasterPages in ASP.net and at the same time not call in the <head> tag?

Upvotes: 1

Views: 659

Answers (2)

rick schott
rick schott

Reputation: 20617

ASP.NET with masterpages, script reference best approach is in the <head id="head1" runat="server"> tag. If you need inline script, just inject them via RegisterStartupScript with .ready() and let ASP.NET and jQuery do the work for you.

Upvotes: 0

SLaks
SLaks

Reputation: 887395

You can make a separate ContentPlaceholder after the jQuery <script> tag in the master, and include your other scripts in it in the content pages.

Upvotes: 3

Related Questions