1

I have a date picker in my form and it is not displaying properly in any browser

<div class="col-md-10">
    @Html.TextBoxFor(model => model.DateJoined, new { @class = "datepicker" })
    @Html.ValidationMessageFor(model => model.DateJoined)
</div>

I have added jquery UI and added Javascript like this:

<script src="~/Scripts/jquery-2.1.1.js"></script>
<script src="~/Scripts/jquery-ui-1.10.4.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
<script type="text/javascript">
    $(function () { // will trigger when the document is ready
        $('.datepicker').datepicker(); //Initialise any date pickers
    });
</script>

And this is how it is displaying in UI:

enter image description here

2
  • 1
    Have you included the relevant .css files? Commented Jun 15, 2014 at 9:29
  • could u please tell me the necessary css for this datepicker Commented Jun 15, 2014 at 9:32

2 Answers 2

2

Demo

JQuery UI

You need to include following files

//css file jQuery UI
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">

//jQuery file js reference.
<script src="//code.jquery.com/jquery-1.10.2.js"></script>

//jQuery UI js reference.
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
Sign up to request clarification or add additional context in comments.

3 Comments

Dead link. Doesn't add value to this question at all.
How is it dead? Its a working demo for datepicker. As the problem was just with the css files.
Link working now, but you should at least add some context from the page because it could go down permenently. adding the +1 back.
0

In the App_Start/Bundle.config

bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.min.css",
                      "~/Content/site.css",
                      "~/Content/jquery-ui.css"));

Comments

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.