In this article I will explain with an example, how to implement Hijri (Islamic) Calendar in ASP.Net Core Razor Pages.
 
 
Download Bootstrap Hijri (Islamic) DatePicker Plugin
You will need to download the plugin files from the following location.
The complete documentation can be read on the following page.
 
 
Razor PageModel (Code-Behind)
Handler method for handling GET operation
This Handler method is left empty as it is not required.
 
Handler method for handling Button Click and POST operation
Inside this Handler method, the value of the selected date from the Hijri DatePicker is fetched and set in the public property HijriDate.
public class IndexModel : PageModel
{
    public string HijriDate { get; set; }
    public void OnGet()
    {
    }
 
    public void OnPostSubmit(string selectedDate)
    {
        this.HijriDate = selectedDate;
    }
}
 
 
Razor Page (HTML)
Inside the Razor Page, the ASP.Net TagHelpers is inherited.
The Razor Page consists of an HTML Form which has been created using the ASP.Net TagHelpers with the following attribute.
method – It specifies the Form Method i.e. GET or POST. In this case it will be set to POST.
Inside the Form, there is a TextBox and a Submit Button Control.
The Submit Button has been set with the POST Handler method using the asp-page-handler attribute.
Note: In the Razor PageModel, the Handler method name is OnPostSubmit but here it will be specified as Submit when calling from the Razor HTML Page.
 
Bootstrap Hijri DatePicker Plugin implementation
Inside the HTML Markup, first the following CSS are inherited.
1. bootstrap.min.css
2. bootstrap-datetimepicker.min.css
 
And then, the following JS scripts are inherited.
1. jquery.min.js
2. moment.min.js
3. moment-hijri.js
4. bootstrap-hijri-datetimepicker.js
Inside the jQuery document ready event handler, the ASP.Net TextBox has been applied with the Bootstrap Hijri DatePicker plugin.
 
Submitting the Form
When the date is selected and the Submit button is clicked, the Form is submitted and the public property HijriDate is checked for NULL and if it is not NULL then, the value of the HijriDate is displayed using JavaScript Alert Message Box.
@page
@addTagHelper*, Microsoft.AspNetCore.Mvc.TagHelpers
@model Hijri_Calendar_Core_Razor.Pages.IndexModel
@{
    Layout = null;
}
 
<!DOCTYPE html>
 
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    <form method="post">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <input type="text" id="txtHijriDate" name="selectedDate" />
                    <input type="submit" class="btn btn-primary" value="Submit" asp-page-handler="Submit" />
                </div>
            </div>
        </div>
    </form>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" rel="stylesheet"/>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/moment-hijri@2.1.0/moment-hijri.js"></script>
    <script src="~/assets/js/bootstrap-hijri-datetimepicker.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#txtHijriDate").hijriDatePicker();
        });
    </script>
    @if (Model.HijriDate != null)
    {
        <script type="text/javascript">
            window.onload = function () {
                alert('@Model.HijriDate');
            };
        </script>
    }
</body>
</html>
 
 
Screenshot
ASP.Net Core Razor Pages: Implement Hijri (Islamic) Calendar
 
 
Demo
 
 
Downloads