0

I'm having the "Microsoft JScript runtime error: Object doesn't support this property or method" error when calling the datepicker function on a textbox generated from my data model.

in the head section I have:

<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $('#dob').datepicker();
    });

and in the body section I have:

<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm()) { %>

...

<tr>
    <td class="label">Date of Birth:</td>
    <td><%: Html.TextBoxFor(model => model.dob, new { @class = "inputtext" })%></td>
    <td><%: Html.ValidationMessageFor(model => model.dob) %></td>
</tr>

...

<% } %>

Do I have something in the wrong place?

Again, you folks are a great help and assistance would be greatly appreciated.

3 Answers 3

2

The DatePicker is part of JQueryUI. You will have to pick a theme and download the css and js for the package (you will choose which features you want, and DatePicker is one of the options).

Note: This is from memory as jqueryui.com is currently down.

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

2 Comments

I've added a jquery ui css reference (redmond) and still get the same response.
What about the jQueryUI .js file?
0

but what about this:

    <link type="text/css" href="../../Content/ui/jquery.ui.all.css" rel="stylesheet" />
    <script type="text/javascript" src="../../Scripts/jquery-1.4.2.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.ui.core.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.ui.widget.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.ui.datepicker.js"></script>
    <link type="text/css" href="../../Content/ui/demos.css" rel="stylesheet" />
    <script type="text/javascript">
    $(function() {
        $("#datepicker").datepicker();
    });
    </script>

i have reference all that it need, but it stil has the same problem

it works now... the problem is jquery.ui.all.css... it suppose to copy the whole files in the fold while i just copy one of them...

Comments

0

try it it is working

<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm()) { %>

<tr>
    <td class="label">Date of Birth:</td>
    <td><%: Html.TextBoxFor("dob")%></td>
    <td><%: Html.ValidationMessageFor(model => model.dob) %></td>
</tr>
...

<% } %>

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.