如何使用脚本管理器引用Twitter Bootstrap DatePicker

时间:2014-02-25 12:25:38

标签: javascript twitter-bootstrap datepicker

您好我已下载twitter bootstrap style datepicker from Stefan Petre

但是我仍然试图在当前项目中尝试引用.js文件和css文件。 我已经安装了twitter bootstrap,它似乎工作正常。 我将bootstrap-datepicker.js文件复制到我的Scripts目录中,但当我尝试在我的母版页中引用它时,如下所示:

<form runat="server" class="form-horizontal">
    <asp:ScriptManager runat="server">
        <Scripts>
            <asp:ScriptReference Name="MsAjaxBundle" />
            <asp:ScriptReference Name="jquery" />
            <asp:ScriptReference Name="bootstrap" />
            <asp:ScriptReference Name="bootstrap-datepicker.js" Path="~/Scripts/bootstrap-datepicker.js"/>
            <asp:ScriptReference Name="respond" />
            ...
        </Scripts>
    </asp:ScriptManager>       
    <div class="container body-content">
        <asp:ContentPlaceHolder ID="MainContent" runat="server">
        </asp:ContentPlaceHolder>            
    </div>
</form>

它给出以下错误: 程序集“System.Web.Extensions,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35”不包含名为“bootstrap-datepicker.js”的Web资源。确保资源名称拼写正确。

有人可能会引导我朝着正确的方向前进。

谢谢。

2 个答案:

答案 0 :(得分:0)

尝试从名称中删除.js并解决该错误

答案 1 :(得分:0)

对我来说简短的回答,最终从De Morgan's Law的各种内容中提炼出来 是只需要Path标注:

<asp:ScriptReference Path="~/Scripts/bootstrap-datepicker.js" />