此页面缺少HtmlHead控件,该控件是要添加的CSS样式表链接所必需的。请加

时间:2013-08-22 04:08:03

标签: asp.net ajax asp.net-ajax

我有页面并添加了Ajax扩展,但它给我带来了错误

我正在使用母版页,因此该页面没有<head>

页码

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" runat="server" %>


<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <table style="width: 100%">
    <tr>
        <td colspan="5" style="text-align: center; height: 20px;">Search </td>
    </tr>
    <tr>
        <td style="text-align: center; height: 20px;">Ticket number</td>
        <td style="text-align: center; height: 20px;">Client name</td>
        <td style="text-align: center; height: 20px;">Address</td>
        <td style="text-align: center; height: 20px;">Assigned to</td>
        <td style="text-align: center; height: 20px;">Date</td>
    </tr>
    <tr>
        <td style="width: 157px">
            <asp:TextBox ID="txt_incID" runat="server" Width="146px"></asp:TextBox>
        </td>
        <td>
            <asp:TextBox ID="txb_ClientName" runat="server" Width="146px"></asp:TextBox>
        </td>
        <td>
            <asp:DropDownList ID="ddl_Address" runat="server" Width="146px" DataSourceID="Ds_address" DataTextField="StrName" DataValueField="StrID">
                <asp:ListItem Value="null"></asp:ListItem>
            </asp:DropDownList>
        </td>
        <td>
            <asp:DropDownList ID="ddl_EmpID" runat="server" Width="146px" DataSourceID="DS_Employee" DataTextField="LastName" DataValueField="EmpID">
                <asp:ListItem Value="null"></asp:ListItem>
            </asp:DropDownList>
        </td>
        <td>
            <asp:TextBox ID="txb_date" runat="server" Width="146px"></asp:TextBox>

            <asp:CalendarExtender ID="txb_date_CalendarExtender" runat="server" Enabled="True" TargetControlID="txb_date">
            </asp:CalendarExtender>

        </td>
    </tr>
    <tr>
        <td style="width: 157px">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td style="width: 157px">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
</table>

    <br />
    <br />
    <asp:SqlDataSource ID="Ds_address" runat="server" ConnectionString="<%$ ConnectionStrings:TicketsConnectionString %>" SelectCommand="SELECT * FROM [Streets]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="DS_Employee" runat="server" ConnectionString="<%$ ConnectionStrings:TicketsConnectionString %>" SelectCommand="SELECT * FROM [Employee]"></asp:SqlDataSource>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

</asp:Content>

在其他主题中,人们建议添加此

<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>

但我在我的页面上有它。任何想法如何解决?
主页代码

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

<!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">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Tickets</title>
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700|Archivo+Narrow:400,700" rel="stylesheet" type="text/css">
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
    <style type="text/css">
        .Buttons
        {
            font-family: Tahoma;
            font-size: large;
            background-color: #999999;
            border-bottom-color: #FF0000;
            border-style: none none outset none;
        }
        .Logins
        {
            font-family: tahoma;
            color: #FF0000;
        }
        .ButtonsInSite
        {
            font-family: tahoma;
            background-color: #C0C0C0;
            border-color: #FFFFFF #FFFFFF #FF0000 #FFFFFF;
            border-bottom-style: double;
            border-radius: 7px;
            -moz-border-radius: 7px;
            -webkit-border-radius: 7px;
            box-shadow: 0px 2px 9px #800000;
            font-weight: bold;
        }
    </style>
    </head>
<body>
    <form id="form1" runat="server">
<div id="header-wrapper">
    <div id="header">
        <div id="logo">
            <h1>Tickets</h1>
            <div style="text-align: right">

                <asp:LoginName ID="LoginName2" runat="server" CssClass="Logins" />
                &nbsp;|
                <asp:LoginStatus ID="LoginStatus1" runat="server" CssClass="Logins" />
            </div>
        </div>
    </div>
</div>
<div id="wrapper"> 
    <!-- end #header -->
    <div id="page">
        <div id="page-bgtop">
            <div id="page-bgbtm">
                <div id="sidebar">
                    <h2>Navigation</h2>
                    <asp:Button ID="Button1" runat="server" Text="Button" Width="118px" CssClass="ButtonsInSite" />
                    <br />
                    <asp:Button ID="Button2" runat="server" Text="Button" Width="118px"  CssClass="ButtonsInSite"/>
                    <br />
                    <asp:Button ID="Button3" runat="server" Text="Button" Width="118px" CssClass="ButtonsInSite"/>
                    <br />
                    <asp:Button ID="Button4" runat="server" Text="Button" Width="118px" CssClass="ButtonsInSite"/>
                    <br />
                    <asp:Button ID="Button5" runat="server" Text="Admin" Width="118px" CssClass="ButtonsInSite" PostBackUrl="~/Admin/AdmStart.aspx"/>
                    <br />


                </div>
                <!-- end #sidebar -->
                <div id="content">
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                    </asp:ContentPlaceHolder>
                </div>
                <!-- end #content -->

                <div style="clear: both;">&nbsp;</div>
            </div>
        </div>
    </div>
    <!-- end #page --> 
</div>
<div id="footer">
    <p> © 2013</p>
</div>
<!-- end #footer -->
    </form>
</body>
</html>

7 个答案:

答案 0 :(得分:4)

可能这会对你有所帮助。 母版页Html

 <asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>

    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>

儿童页面Html

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">Add Scripts here</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
Add Page Content Here</asp:Content>

答案 1 :(得分:2)

在母版页中添加

<head runat="server">

答案 2 :(得分:1)

  

在子页面标题中,ContentPlaceHolderID只需添加<head runat="server"></head>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2Header" runat="Server">
    <head runat="server">
    </head>
    <script src="http://code.jquery.com/jquery-latest.min.js"
        type="text/javascript"></script>  
</asp:Content>

答案 3 :(得分:0)

您可以将<head runat="server">添加到母版页吗?

答案 4 :(得分:0)

在母版页添加

<head id="Head1" runat="server">
//Other script

<asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>

在子页面添加

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
//add script for child page
<script>
</script>
</asp:Content>

答案 5 :(得分:0)

试试这个

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

<!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">
<head runat="server">

答案 6 :(得分:0)

在MASTER PAGE代码中! 只需将<head>替换为<head id="head1" runat="server">

即可