1

I want a datepicker to show when i click my textbox, but it does not, I have done some searching and nothing helped me.

submittime.aspx

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<form action="/Item/Submit" method="post">
    <fieldset>
        <legend>Set time</legend>
        <div class ="editor-label"><label for="expire"><b>End date</b></label></div> 
        <div class ="editor-field"><input id="expire" name="expire" type="text" style="width: 500px; height: 20px"/></div>
        <script type="text/javascript">
            $(function() {
                $('#expire').datepicker({
                    changeMonth: true,
                    changeYear: true,
                    dateFormat: 'dd/mm/yy'
                });
            }); 
        </script>
    <input type="submit" value="Submit" style="width: 72px" />
    </fieldset>
</form>
</asp:Content>

I have added following code to Site.Master

<link type="text/css" href="css/themename/jquery-ui-1.8.18.custom.css" rel="Stylesheet" />  
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>

It shows my textbox but no datepicker shows when i click it, any help would be nice.

1
  • Not very sure about this, but don't think the date is in correct format, try dateFormat: 'dd-mm-yy' Commented Apr 4, 2012 at 10:01

1 Answer 1

1

You're missing the $(document).ready()

so your code should look something like this:

$(document).ready(function(){
    $('#expire').datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: 'dd/mm/yy'
    });
});

jsFiddle example : http://jsfiddle.net/hcBL2/

Sign up to request clarification or add additional context in comments.

2 Comments

Still nothing, but i can see in jsFiddle that it should work. Maybe something is wrong with my references? Where in the site.master should they be listed?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.