javascriptasp.net-mvccalendarculturepersian

Persian Calender in MVC , Asp.net


I use a DateTime variable in MVC and I want to show Persian calender for

@Html.EditorFor(x=> x.ProductionDate)

How can I do it?


Solution

  • I found the solution

    1.Go to www.amib.ir/weblog/?page_id=316 and download the latest version of "AMIB_jsPersianCal"


    2.Add "js-persian-cal.min.js" and "js-persian-cal.css" and "pcal.png" to your project
    you can change the css for specified the Url of PNG file

    3.Add the css and js file to your cshtml file

    <link href="@Url.Content("~/Content/js-persian-cal.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/js-persian-cal.min.js")"></script>
    


    4.change your date file like

    @Html.TextBoxFor(m => m.Birthdate, new { @id = "pcal1", @class = "pdate" });
    

    note: I use string variable for Birthdate


    5.add the script to the end of cshtml File

    <script type="text/javascript">
    var objCal1 = new AMIB.persianCalendar('pcal1'); </script>