Hello, I'm trying to implement the jquery ui datepicker in an asp.net mvc 4 project. I Always get the error, that the method or property "datepicker" is not supported. Normally the new MVC 4 loads all the files in bundles. Is there any known issue with js
file loading? Can someone give me a hint? See my code below:
rodin3D
Member
1 Points
6 Posts
JQuery UI Datepicker not working
Jun 29, 2012 12:01 PM|LINK
Hello, I'm trying to implement the jquery ui datepicker in an asp.net mvc 4 project. I Always get the error, that the method or property "datepicker" is not supported. Normally the new MVC 4 loads all the files in bundles. Is there any known issue with js file loading? Can someone give me a hint? See my code below:
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script> $(document).ready(function () { $("#datepicker").datepicker(); }); </script> <h2>Projektanträge</h2> <input id="datepicker"></input>ignatandrei
All-Star
134511 Points
21576 Posts
Moderator
MVP
Re: JQuery UI Datepicker not working
Jun 29, 2012 12:06 PM|LINK
Why do you have also this loading from google ?
rodin3D
Member
1 Points
6 Posts
Re: JQuery UI Datepicker not working
Jun 29, 2012 12:12 PM|LINK
Removed it. Same Problem :/
bkis1112
Participant
1061 Points
226 Posts
Re: JQuery UI Datepicker not working
Jun 29, 2012 12:33 PM|LINK
download js, css content in this link: http://www.mediafire.com/?8fgfkfbkwtrtocf
then pull css file and jsfile in your view like this
<!--datepicker--> <link href="@Url.Content("~/Content/datepicker/demos.css")" rel="stylesheet" type="text/css" /> <link href="@Url.Content("~/Content/datepicker/jquery.ui.all.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/datepicker/jquery-1.7.2.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/datepicker/jquery-ui-1.8.20.custom.js")" type="text/javascript"> </script> <script src="@Url.Content("~/Scripts/datepicker/jquery.ui.core.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/datepicker/jquery.ui.datepicker.js")" type="text/javascript"></script> <!--end datepicker-->add bellow code where you want date picker appear
remember javascript:
<script type="text/javascript"> $(function () { $("#datepicker").datepicker({ showButtonPanel: false }); }); </script>Thanks for reading my post
Trần Lê Thành Trung
abdu292
Participant
1553 Points
371 Posts
Re: JQuery UI Datepicker not working
Jun 29, 2012 12:36 PM|LINK
Drag the scripts files from the "Scripts" folder and drop on to your view to see if it works.
Regards,
With best regards,
rodin3D
Member
1 Points
6 Posts
Re: JQuery UI Datepicker not working
Jun 29, 2012 12:41 PM|LINK
donwloaded newest files. Dragged and dropped the hell out of it. Still not working.
abdu292
Participant
1553 Points
371 Posts
Re: JQuery UI Datepicker not working
Jun 29, 2012 12:50 PM|LINK
Share the sample project with us.
(Create SkyDrive account using the link below to share your project (this would be useful for you any way) if you don't have one already).
https://skydrive.live.com/
Best Regards,
With best regards,
rodin3D
Member
1 Points
6 Posts
Re: JQuery UI Datepicker not working
Jun 29, 2012 12:57 PM|LINK
When I create a ASP.NET MVC 4 Project with basic / internet template I get this error.
When I create a ASP.NET MVC 3 Project with internet template I do not get this error.
Just dragged and dropped jquery an jquer.ui min scripts into a view and pasted the code below:
<script> $(document).ready(function () { $("#datepicker").datepicker(); }); </script> <input id="datepicker"></input>abdu292
Participant
1553 Points
371 Posts
Re: JQuery UI Datepicker not working
Jun 29, 2012 02:37 PM|LINK
Please post your script references tags.
With best regards,
sushanth009
Contributor
6243 Points
1168 Posts
Re: JQuery UI Datepicker not working
Jun 29, 2012 03:31 PM|LINK
There are many types of inputs types like buttons, text etc. And I think d.datapicker method expects a input of type="text" to make it work.
Make the change and see if it works..