0

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.

nakiya
  • 14,063
  • 21
  • 79
  • 118
  • `Simple not work` ? Do you get any javascript error ? did you check the html rendered html ? Do you have follow all the steps of juice ? The simple not work can not help. – Aristos Dec 14 '12 at 06:48
  • Thanks for mensioning the above. I looked at javascript errors. Edited question. – nakiya Dec 14 '12 at 07:03
  • Now you see your error - do you need an official answer ? You must include on the javascript files the jQuery library. – Aristos Dec 14 '12 at 07:14

1 Answers1

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

Community
  • 1
  • 1
Aristos
  • 66,005
  • 16
  • 114
  • 150
  • Thanks for the pointers. Got it working. But it was a bit different. I had a `ScriptManager` in there that had `ScriptReference`s with `Name` but not `Path`. Started working properly after I added the `Path`s. Editing problem with solution. – nakiya Dec 14 '12 at 07:51