Search code examples
asp.netwebformsmaster-pages

Error on adding <script> to master page


I have a Master page that have these ContentPlaceHolder:

<asp:ContentPlaceHolder ID="title" runat="server">
    </asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="contentTitle" runat="server" ></asp:ContentPlaceHolder>
        <asp:ContentPlaceHolder ID="content" runat="server">
        </asp:ContentPlaceHolder>

when I add these codes for jquery in<head> part of master page:

<script type="text/javascript" src="script/jquery-2.0.1.min.js" />
<link href="script/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="script/jquery.contextMenu.js" />

and create new aspx file that use that master page ;

<%@ Page Title="" Language="C#" MasterPageFile="~/Default.Master"    AutoEventWireup="true" CodeBehind="Bed.aspx.cs" Inherits="Zhotel.Lists.Bed" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentTitle" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="content" runat="server">
</asp:Content>

when I want to view Design part of file it show me this error:

enter image description here

and when I remove script tags then no more this error occurs.

How can I use script tag that this error not shown?


Solution

  • Add </script> to end of jquery definition, like this:

    <script src="script/jquery-2.0.1.min.js" type="text/javascript"></script>
    <script src="script/jquery.contextMenu.js" type="text/javascript"></script>