Calendar code in a View
i want a calender that has text box, created in mvc4 razor in a view
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Sunny SharmaRank #223 · 11.1K pointsPosted Aug 13, 2013, 8:31 PM EDT
Do you want a text box inside Calender or a Calender on TextBox Click or hover or etc...? please clarify.
Thanks.
Sunny SharmaRank #223 · 11.1K pointsPosted Aug 13, 2013, 8:37 PM EDT
Follow the code below if you want so:
----------------------------------------------------------------------
@{ Layout = null; }
<!Doctype html>
<html lang="en" >
<head> <title> Sample Date picker in MVC4 Razor view </title>
<link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script >
$(document).ready(function () {
$("#txtDate").datepicker({dateFormat:"yy-mm-dd"}); });
</script>
</head>
<body>
@Html.Label("jQuery DatePicker")
@Html.TextBox("txtDate")
@Html.Label("HTML5 DatePicker");
<input type="date" id="txtDate2" />
</body>
</html>
-------------------------------------------------------------------------------------
Hope it helps :)