问题
I'm new to web development. Wanted to try my hand at ASP.NET + JuiceUI. Starting from the basic web site project template in visual studio, I wanted to try and get the JuiceUI Datepicker control in a web page. I followed the instructions and installed JuiceUI into my project with nuget. But when I tried to get a juice Datepicker into my page it simply does not work:
Default.aspx
<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1><%: Title %>.</h1>
<h2>Modify this template to jump-start your ASP.NET application.</h2>
</hgroup>
<p>
<asp:TextBox id="_test" runat="server" ></asp:TextBox>
<juice:Datepicker TargetControlID="_test" runat="server" />
</div>
</section>
</asp:Content>
And it does not work... I get a dumb textbox in the page and that's it. As this is very simple code I guess I must have made some stupid error somewhere. I would be thankful if anyone can help me coz I am new to web dev.
EDIT
Javascript errors:
ReferenceError: jQuery is not defined [http://localhost:2964/Scripts/amplify.js:788]
ReferenceError: jQuery is not defined [http://localhost:2964/Scripts/juice.js:201]
Solution:
ScriptManager
created with nuget installation of Juice:
<asp:ScriptManager runat="server">
<Scripts>
<asp:ScriptReference Name="jquery"/>
<asp:ScriptReference Name="jquery.ui.combined"/>
</Scripts>
</asp:ScriptManager>
Fix:
<asp:ScriptManager runat="server">
<Scripts>
<asp:ScriptReference Name="jquery" Path="~/Scripts/jquery-1.8.3.js"/>
<asp:ScriptReference Name="jquery.ui.combined" Path="~/Scripts/jquery-ui-1.9.2.js"/>
</Scripts>
</asp:ScriptManager>
And it works.
回答1:
From your errors is very clear that you need to inlcude the jQuery library
http://jquery.com/
before the call of the juice, probably on the top of your aspx pages.
eg:
<script type="text/javascript" src="jquery.js"></script>
more:
Where do you include the jQuery library from? Google JSAPI? CDN?
http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery
来源:https://stackoverflow.com/questions/13873629/cant-get-juice-ui-to-work