Reputation: 85
How do i add datepicker using bootstrapdatepicker in MVC application?
Am creating one application using .net MVC. I want to add datepicker. I downloaded bootstrapdatepicker using nu-get package. Could anyone please explain how to use it? I tried below but it doesn't work.
Addded js and css files
Then i added one input box in my page Hide Copy Code
<input type="text" id="gd" type="text" class="form-control">
added below code as well Hide Copy Code
$(document).ready(function () {
$("#gd").datepicker({
calendarWeeks: true
});
});
Please suggest if you have any other way to do this or explain me how to do this using nuget package? But nothing is coming when I click on input box . But am expecting datepicker to populate. What is the issue here?
Upvotes: 0
Views: 739
Reputation: 31
look for the tool button in toolbar, select nuget package manager , select package Manager Console, type in package Manager console "Install-Package datepicker
Upvotes: 1
Reputation: 4910
You need to have
for making Datepicker
to work. The reason it is not working for you might be because you installed the datepicker
from NuGet package
, but the downloaded files are not included in the files in which you want datepicker. Please make sure all the files below are included in the order they are. It should work.
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"></script>
<script src="~/Scripts/bootstrap-datepicker.min.js"></script>
<link href="~/Content/bootstrap-datepicker.min.css" rel="stylesheet" />
Here's the code that worked for me.
Upvotes: 0