Ruwangi
Ruwangi

Reputation: 243

Using jQuery in ASP.NET

Okay, this might sound like a stupid question, but where exactly do I add the line <script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> in a .aspx page? I am newbie to both ASP.NET and jQuery. I am given a half complete ASP.NET project and I need to use jQuery to configure the UI. Everywhere I searched, it says first insert the above line inside the <head> tag. But my Default.aspx page does not have a <head> tag. Instead it has <asp:Content> and <asp:UpdatePanel> tags.

Upvotes: 0

Views: 133

Answers (2)

Felix Cen
Felix Cen

Reputation: 773

Find you master page, normally it is called Site.master, and it's located in the root of the solution

For example

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
    <title></title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form runat="server">

        <div class="main">
            <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
        </div>
    </form>
</body>
</html>

Upvotes: 2

Umer Hayyat
Umer Hayyat

Reputation: 406

Masterpage in webform is the place where you include all common css, javascripts. this can be found in another question on stackoverflow here

Upvotes: 1

Related Questions