无法使用母版页中的Javascript文件

时间:2014-05-01 06:28:41

标签: asp.net c#-4.0

我有主要的主页,我包含了java脚本文件(日历应用程序)。但是没有像我期望的那样工作,也不会解雇任何行动。有解决方案吗?什么是使用在主页

指定的任何js,css的标准
 =======================MasterPage file=============================
    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head  runat="server">
    <link href="js/datecss.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" language="javascript" src="datescript.js" ></script>

    <link href="../css/templatemo_style.css" rel="stylesheet" type="text/css" />


    <link href="css/jquery.ennui.contentslider.css" rel="stylesheet" type="text/css" media="screen,projection" />
        <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
        </asp:ContentPlaceHolder>
        <title>Untitled Page</title>
        <style type="text/css">

            ul
            {
                list-style-type:none;
            }

            #navmenu 
            {
                background-COLOR: Black;
                width: 150PX;


            }
            .curv
            {

                -webkit-border-radius: 20px 20px 0px 0px;
                -moz-border-radius: 20px 20px 0px 0px;
                border-radius: 20px 20px 0px 0px;
                behavior: url(PIE.htc); 

            }
            .curv1
            {
                border:2px;
                -webkit-border-radius: 20px;
                -moz-border-radius: 20px;
                border-radius: 20px;
                behavior: url(PIE.htc);   
            }

            .Mstyle2
            {
                height: 368px;
            }
            .Mstyle3
            {
                border:1px;
                border-color:Gray;
                height: 44px;
                border-top:2px solid #00F;
                background: #74DF00;
                background: -webkit-gradient(linear, 0 0, 0 bottom, from(#74DF00), to(#0B3B0B));
                background: -webkit-linear-gradient(#74DF00, #0B3B0B);
                background: -moz-linear-gradient(#74DF00, #0B3B0B);
                background: -ms-linear-gradient(#74DF00, #0B3B0B);
                background: -o-linear-gradient(#74DF00, #0B3B0B);
                background: linear-gradient(#74DF00, #0B3B0B);
                -pie-background: linear-gradient(#74DF00, #0B3B0B);
                behavior: url(PIE.htc);

            }

            .Mstyle4
            {
                height: 5px;
                border-color: Navy;
                border:2px;
                background: #2E9AFE;
                background: -webkit-gradient(linear, 0 0, 0 bottom, from(#2E9AFE), to(#81DAF5));
                background: -webkit-linear-gradient(#2E9AFE, #81DAF5);
                background: -moz-linear-gradient(#2E9AFE, #81DAF5);
                background: -ms-linear-gradient(#2E9AFE, #81DAF5);
                background: -o-linear-gradient(#2E9AFE, #81DAF5);
                background: linear-gradient(#2E9AFE, #81DAF5);
                -pie-background: linear-gradient(#2E9AFE, #81DAF5);
                behavior: url(PIE.htc);

                -webkit-border-radius: 1px;
                -moz-border-radius: 1px;
                border-radius: 1px;
                behavior: url(PIE.htc);
            }

                .Mstyle9
                {
                      border:2px solid;

                 border-color : #006699;
                 border :2px;
                 -webkit-border-radius: 20px 20px 0px 0px;
                -moz-border-radius: 20px 20px 0px 0px;
                border-radius: 20px 20px 0px 0px;
                behavior: url(PIE.htc); 

                }

                .Mstyle10
                {
              border: 1px solid #696;
    padding: 60px 0;
    text-align: center; width: 200px;
    -webkit-border-radius: 20px;
    -moz-border-radius: 20px;
    border-radius: 20px;
    background: #EEFF99;
    behavior: url(PIE.htc);
                }



            .style1
            {
                height: auto;
            }
            .style2
            {
                border-style: none;
                border-width: 2px;
                border-color: inherit;
                -webkit-border-radius: 20px 20px 0px 0px;
                -moz-border-radius: 20px 20px 0px 0px;
                border-radius: 20px 20px 0px 0px;
                behavior: url(PIE.htc);
                height: 100px;
            }






        </style>
    </head>
    <body bgcolor="black">
        <form id="form1" runat="server">
        <div>

        </div>
        <table  align="center" border="0" width="900px" class="curv";
            style="border-spacing: 0px; empty-cells: ;  caption-side: "">
        <tr width="900px">
            <td valign="middle" 
                align="center" width="900px" class="style2 curv1" height="130px"


                style="border: medium solid #3366CC; padding: 0px; background-color: #336699;" >

            <!-- <object width="900" height="130px" class="Mstyle9">
            <embed src="../image/headernew.swf" type="application/x-shockwave-flash" width="900px" height="130px" class="Mstyle9"></embed>
        </object>
    [endif]-->
                 <!--<div class="ethioCsdTs-flash-alt"><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></div>
        <!--[if !IE]>-->

        <!--<![endif]-->

    <object id="flash" style="width: 900px; height: 130px;" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="900px" height="130px" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" align="centre">
    <param name="movie" value="../image/headernew.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="transparent"/>
    <param name="bgcolor" value="#ffffff" /> <embed type="application/x-shockwave-flash" width="900px" height="130px" src="../image/headernew.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" name="Web" bgcolor="#ffffff" quality="high"></embed>
    </object>

    <!--<object id="flash" style="width: 900px; height: 50px;" width="900px" height="50px" name="Web" data="../image/headernew.swf" type="application/x-shockwave-flash">
    <param name="movie" value="../image/headernew.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#FFFFFF" />
    <param name="wmode" value="transparent" />
    </object>
    <!--<![endif]-->

        </td> </tr>
        <tr>

            <td valign="middle" 
                align="center" class="Mstyle4" bgcolor="blue" 
                style="border: thin double #0066CC; vertical-align: top;"> </td> </tr>
          <tr>

            <td width="900px" bgcolor="white" class="style1" height="auto"

                style="border-style: solid; border-width: 0px thin thin thin; border-right-color: #C0C0C0; border-bottom-color: #C0C0C0; border-left-color: #C0C0C0; border-spacing: 0px; empty-cells: 0; caption-side: 0; border-collapse: 0; table-layout: 0;">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                </asp:ContentPlaceHolder>

            </td>
        </tr>
        <tr>
            <td align="center" class="Mstyle3" bgcolor="blue">
                <span lang="en-us">TS TEAM TEP</span></td>
        </tr>
        </table>

        </form>
    </body>
    </html>


    ==========================The client file========================================
    <%@ Page Language="C#" MasterPageFile="~/AttendanceMasterPage.master" AutoEventWireup="true" CodeFile="FleetReportWithoutVehicle.aspx.cs" Inherits="FleetReportWithoutVehicle" Title="Untitled Page" %>

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

     <div>
            <div>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                Please Generate Attendance Follow Up Report Here<br />
            </div>
            StartDate
            <asp:TextBox ID="txtstartdate" runat="server"></asp:TextBox>
            <a href="#" onclick="displayDatePicker('txtstartdate','','mdy');">
                                <img  src="calendar_view_day.png" alt="img" style="width:25px; height:25px; border:none" /></a>&nbsp;&nbsp;
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="txtstartdate" ErrorMessage="Please Select Start Date"></asp:RequiredFieldValidator>
            End Date&nbsp;
            &nbsp;<asp:TextBox ID="txtEndDate"  runat="server" ReadOnly="false"></asp:TextBox>
    <a href="#" onclick="displayDatePicker('txtEndDate','','mdy');">
                                <img  src="calendar_view_day.png" alt="img" style="width:25px; height:25px; border:none" /></a>
    &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                ControlToValidate="txtEndDate" ErrorMessage="Please Select End Date"></asp:RequiredFieldValidator>
            <br />
            <br />
            <br />
            &nbsp;Select Office&nbsp;<asp:DropDownList ID="ddnOfficeLocation" 
                runat="server" DataSourceID="SqlDataSource3" DataTextField="OfficeLocationName" 
                DataValueField="OfficeLocationName">
            </asp:DropDownList>
            <br />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ATCF %>" 
                SelectCommand="SELECT DISTINCT * FROM [tblOfficeLocation]">
            </asp:SqlDataSource>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnSearch" runat="server" onclick="btnSearch_Click" 
                Text="Search" />
            <br />
            <br />
            <br />
            <asp:GridView ID="GridView1" runat="server" CellPadding="4" 
                DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" 
                AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False">
                <RowStyle BackColor="#EFF3FB" />
                <Columns>
                    <asp:BoundField DataField="RouteName" HeaderText="RouteName" 
                        SortExpression="RouteName" />
                    <asp:BoundField DataField="NumberOfEmployee" HeaderText="NumberOfEmployee" 
                        SortExpression="NumberOfEmployee" />
                    <asp:BoundField DataField="OfficeLocationName" HeaderText="OfficeLocationName" 
                        SortExpression="OfficeLocationName" />
                    <asp:BoundField DataField="RequestDate" HeaderText="RequestDate" 
                        SortExpression="RequestDate" />
                </Columns>
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#2461BF" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ATCF %>" 

                SelectCommand="SELECT * FROM [viewFleetReportWithoutVehicleSummary] WHERE (([RequestDate] &gt;= @RequestDate) AND ([RequestDate] &lt;= @RequestDate2) AND ([OfficeLocationName] = @OfficeLocationName))">
                <SelectParameters>
                    <asp:ControlParameter ControlID="txtstartdate" DbType="Datetime" Name="RequestDate" 
                        PropertyName="Text" />
                    <asp:ControlParameter ControlID="txtEndDate" DbType="Datetime" Name="RequestDate2" 
                        PropertyName="Text" />
                    <asp:ControlParameter ControlID="ddnOfficeLocation" Name="OfficeLocationName" 
                        PropertyName="SelectedValue" Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
            <br />
            Fleet Detail Report<br />
            <br />

        </div>
        <div style="overflow:auto; height:200px;">
        <asp:GridView ID="gvDetailFleet" runat="server" DataSourceID="SqlDataSource2" 
             AllowSorting="True"  AutoGenerateColumns="true"
            DataKeyNames="OracleId" CellPadding="4" ForeColor="#333333" 
            GridLines="None">
            <RowStyle BackColor="#EFF3FB" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />

        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ATCF %>" 




                SelectCommand="SELECT [OracleId], [FirstName], [MiddleName], [LastName], [SectionName], [CoachGroupName], [RequestDate], [ShiftGroupName], [SubcityName], [OfficeLocationName], [RouteName], [SpecficLocation] FROM [ViewFleet] WHERE (([RequestDate] &gt;= @RequestDate) AND ([RequestDate] &lt;= @RequestDate2) AND ([OfficeLocationName] = @OfficeLocationName))">
            <SelectParameters>
                <asp:ControlParameter ControlID="txtstartdate" DbType="Datetime" Name="RequestDate" 
                    PropertyName="Text" />
                <asp:ControlParameter ControlID="txtEndDate" DbType="Datetime" Name="RequestDate2" 
                    PropertyName="Text" />
                <asp:ControlParameter ControlID="ddnOfficeLocation" Name="OfficeLocationName" 
                    PropertyName="SelectedValue" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
           </div>
        <br />
        <br />
        <asp:Button ID="btnFleetReportWithoutVehicle" runat="server" onclick="btnExportSalary_Click" 
            Text="Export Fleet Detail  Report" />
        <br />
    </asp:Content>

1 个答案:

答案 0 :(得分:0)

您应该使用ScriptManager,试试这个。

<asp:ScriptManager runat="server" ID="SM1">
   <Scripts>
     <asp:ScriptReference Path="~/datescript.js" />
   </Scripts>
</asp:ScriptManager>

在您的母版页中添加。

MSDN链接了解更多信息。