Hi,
I have bind DataTable in my mvc project, everything working fine except pagination. It is not working.
@model ThomosMason.Web.Controllers.Models.Patient.PatientResponseModel
<script type="text/javascript">
    $(document).ready(function () { 
        //update status of Patient
        $('input[type=checkbox]').change(function () {
            patientid = $(this).closest("tr").find(".ManagePatientID").val();
            statusvale = $('#patientstatusid').val();
            $.ajax({
                type: "POST",
                url: '@Url.Action("PatientUpdateStatus","Patient")',
                data: { PatientId: patientid, IsActive: this.checked },
                success: function (res) {
                    if (res.status) {
                      
                        $.toast({
                            heading: 'Success',
                            text: res.message,
                            showHideTransition: 'slide',
                            icon: 'success'
                        });
                    }
                    else
                    {
                        $.toast({
                            heading: 'Error',
                            text: res.message,
                            showHideTransition: 'slide',
                            icon: 'error'
                        });
                    }                   
                },
                error: function () {
                    $.toast({
                        heading: 'Error',
                        text: res.message,
                        showHideTransition: 'slide',
                        icon: 'error'
                    });
                },
            });
        });
    });
</script>
<nav class="navbar navbar-expand-lg navbar-light bg-transparent pt-4 px-4">
                <div class="d-flex align-items-center">
                    <i class="fas fa-align-left primary-text fs-4 me-3" id="menu-toggle"></i>
                    <h2 class="fs-4 m-0">Patients</h2>
                </div>
            </nav>
            <div class="master-tab-wrapper patient-list-wrapper">
                <div class="container-fluid px-4">
                    <div class="row">
                        <div class="col-md-12">
                            <table id="example" class="table" style="width:100%;">
                                <thead>
                                    <tr>
                                        <th>Sr No.</th>
                                        <th>Patient Name</th>
                                        <th>Last Prescription Date</th>
                                        <th>Total Prescriptions Count</th>                                       
                                        <th>Patient Status</th>
                                        <th>Actions</th>
                                    </tr>
                                </thead>
                                <tbody>
                        @if(Model.totalRecords!=0)
                                    {
                        @foreach (var item in Model.data)
                        {
                            <tr>
                                <td>
                                    @item.SrNo
                                    <input type="hidden" value="@item.PatientID" class="ManagePatientID">
                                </td>
                                <td>@item.PatientName</td>
                                    <td>@item.LastPrescriptionDate.ToShortDateString()</td>
                                <td>@item.PrescriptionCount</td>
                                <td>
                                    <label class="switch">
                                        <input type="checkbox" checked="@item.IsActive" id="patientstatusid">
                                        <span class="slider round"></span>
                                    </label>
                                </td>
                                <td>                                  
                                        <a href="@Url.Action("PatientDetails","Patient" ,new {PatientId=item.PatientID})" class="btn btn-view">View Patients</a>
                                </td>
                            </tr>
                        }
                                    }
                             
                                    
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
      <div class="modal fade" id="deleteprovider" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
        aria-labelledby="deleteProviderLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <h5 class="modal-title text-center">Delete Bessie Cooper provider?</h5>
                    <div class="delete-wrapper text-center">
                        <p class="mb-5 mt-3">Are you sure you want to delete this provider?  </p>
                        <button class="btn btn-cancel me-3">Cancel</button>
                        <button class="btn btn-delete"><span class="material-symbols-outlined me-2">
                                delete
                            </span>Delete</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
 
public IActionResult Index(PatinetSearchModel model)
{
    if (HttpContext.Request.Cookies["Token"] != null && !string.IsNullOrEmpty(HttpContext.Request.Cookies["Token"].ToString()))
    {
        model.Start = 0;
        model.PageSize = model.PageSize > 0 ? model.PageSize : 10;
        AccountApiCall accountApiCall = new AccountApiCall(Configuration["PrescriptionAPI"]);
        var Response = accountApiCall.PostAPIcall<PatientResponseModel>(model, "patient/list", HttpContext.Request.Cookies["Token"].ToString());
        return View(Response);
    }
    else
    {
        return RedirectToAction("Login", "Account");
    }
}
I have implemented pagination in my store procedure. But still data is not displaying.