Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'datetimepicker'

What I have tried:

mycode

My Laout Page
-----------------------------------

<!DOCTYPE html>


    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title
 

    
        ul {
            padding: 0;
            list-style: none;
            background: #f2f2f2;
        }

            ul li {
                display: inline-block;
                position: relative;
                line-height: 21px;
                text-align: left;
            }

                ul li a {
                    display: block;
                    padding: 8px 25px;
                    color: #333;
                    text-decoration: none;
                }

                    ul li a:hover {
                        color: #fff;
                        background: #939393;
                    }

                ul li ul.dropdown {
                    min-width: 100%; /* Set width of the dropdown */
                    background: #f2f2f2;
                    display: none;
                    position: absolute;
                    z-index: 999;
                    left: 0;
                }

                ul li:hover ul.dropdown {
                    display: block; /* Display the dropdown */
                }

                ul li ul.dropdown li {
                    display: block;
                    position: relative;
                }
    








    <div class="container">
        <section class="box">
            
                <div class="container-fluid">
                    <div class="navbar-header">
                        <a class="navbar-brand" href="#"></a>
                    </div>

                    <ul>
                        <li>@Html.ActionLink("Home", "Index", "Home")</li>                        <li>@Html.ActionLink("About", "About", "Home")</li>                        <li>                            <a href="#">Products</a>
                            <ul class="dropdown">
                                <li>                                    @Html.ActionLink("ModalPopUp", "ModalPopUp", "Home")
                                    @Html.ActionLink("Repair", "Repair", "Repair")
                                    @Html.ActionLink("Scanning", "prescaning", "Scanning")

                                </li>                            </ul>




                        </li>                        <li><a href="#">Contact</a></li>                    </ul>
                </div>
            
            <div>
                @RenderBody()
            </div>
            <div class="panel-footer">

            </div>
        </section>
    </div>

    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)







---------------------------End-------------



----------------------ViewPage---------------


@{
    ViewBag.Title = "prescaning";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>prescaning</h2>












    .button {
        background-color: #4CAF50; /* Green */
        border: none;
        color: white;
        padding: 15px 32px;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 16px;
        margin: 4px 2px;
        cursor: pointer;
    }

    .button1 {
        border-radius: 2px;
    }

    .button2 {
        border-radius: 4px;
    }

    .button3 {
        border-radius: 8px;
    }

    .button4 {
        border-radius: 12px;
    }

    .button5 {
        border-radius: 50%;
    }





    <div class="row">
        <div>
            Serial No
            <div class="col-sm-3">

                <div id="lbluser">
                    <div class="form-group">
                        
                    </div>
                </div>


            </div>
        </div>
    </div>
    <br>

    <div class="row">
        <div>
            CardSerialNo
            <div class="col-sm-3">
                <div id="lbluser">
                    <div class="form-group">
                        
                    </div>
                </div>
                @*@Html.TextBox("txtCardSNO", null, new { @class = "form-control", maxlength = 30 })*@

            </div>
        </div>
    </div>
    <br>

    <div class="row">
        <div>
            FaultCode
            <div class="col-sm-3">
                <div class="form-group">
                    
                </div>
                @*@Html.TextBox("txtFaultcode", null, new { @class = "form-control", maxlength = 30 })*@

            </div>
        </div>
    </div>
    <br>

    <div class="row">
        <div>
            DateReceived
            <div class="col-sm-3">
                
                @*@Html.TextBox("txtDateReceived", null, new { @class = "form-control", maxlength = 30 })*@


            </div>
        </div>
    </div>
    <br>
    <div class="row">
        <div>
            PO No
            <div class="col-sm-3">
                
                @*@Html.TextBox("txtPONO", null, new { @class = "form-control", maxlength = 30 })*@

            </div>
        </div>
    </div>
    <br>
    <div class="row">
        <div>
            CardPartNo
            <div class="col-sm-3">
                
                @*@Html.TextBox("txtCardPartNo", null, new { @class = "form-control", maxlength = 30 })*@

            </div>
        </div>
    </div>
    <br>







<div class="modal-footer">
    Save
    Sign



</div>


<div>



    
    $('#txtDateReceived').datetimepicker({
    controlType: 'select',
    oneLine: true,
    timeFormat: 'HH:mm'
    });
     

    
        $(document).ready(function () {
            debugger


            $("#btnSave").click(function () {
                var empObj = {
                    SERIALNO: $('#txtSerialNo').val(),
                    CARDSERIALNO: $('#txtCardSNO').val(),
                    FAULTCODE1: $('#txtFaultcode').val(),
                    DATE_RECEIVED: $('#txtDateReceived').val(),
                    PONO: $('#txtPONO').val(),
                    CARDPARTNO: $('#txtCardPartNo').val(),
                };

                $.ajax({
                    url: "/Scanning/Postprescaning",
                    data: JSON.stringify(empObj),
                    type: "POST",
                    contentType: "application/json;charset=utf-8",
                    dataType: "json",


                    success: function (result) {
                        debugger
                        alert("DATA SAVED !!");

                    },
                    error: function (errormessage) {
                        alert(errormessage.responseText);
                    }

                });
            });
        });
    


</div>



---------------------------end---------------


BundleConfig class

using System.Web;
using System.Web.Optimization;

namespace WebApplication1
{
    public class BundleConfig
    {
        // For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/respond.js"));

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

            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
          "~/Scripts/jquery-ui-1.12.0.js"));
            //css  
            bundles.Add(new StyleBundle("~/Content/cssjqryUi").Include(
       "~/Content/jquery-ui.css"));
        }
    }
}
Posted
Updated 14-Jan-19 18:38pm

1 solution

Just by looking at the code, look like it missing reference to jquery-datetimepicker plugin. Datepicker is part of jQueryUI but not datetimepicker


jquery-datetimepicker - cdnjs.com - The best FOSS CDN for web related libraries to speed up your websites![^]
 
Share this answer
 
Comments
Member 10194266 15-Jan-19 0:52am    
Thanks ,Its working now when i used the datepicker
Bryian Tan 15-Jan-19 14:15pm    
Anytime :)
Member 10194266 31-Jan-19 5:10am    
Hi Bryian ,
I am facing error in view
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[WebApplication1.Models.Menu]', but this dictionary requires a model item of type 'WebApplication1.Models.Menu'.
Bryian Tan 31-Jan-19 8:52am    
The error is very clear, the code is passing in a collection of Models.Menu instead of a Models.Menu object to the view. If collection, you need to update the code to use loop to iterate it. In your case, make sure the controller action is returning a object to the view,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900