jQuery Datepicker in asp .net mvc | Using Jquery datepicker in ASP Dot net MVC

 

at first create a controller then create a view file inside of view  
How to Create controller -> go to controller folder and click right mouse and click add then click controller and setup your controller name and finally click add  then created a controller . 

Index.cshtml


@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<input type="text" name="date" class="datepicker" />
<link href="~/Content/jquery-ui.css" rel="stylesheet" />

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">

@section scripts{
    <script src="~/Scripts/jquery-ui.js"></script>
    <script>
        $(function () {
            $(".datepicker").datepicker({
                dateFormat: "dd-mm-yy",
                changeMonth: true,
                changeYear: true,
                showOn: "both",
                buttonText: "<i class='fa fa-calendar'></i>"
            });
        });
    </script>

}

No comments

Powered by Blogger.