Ramco Ramco

Ramco Ramco

  • 808
  • 2.5k
  • 317.9k

Convert Gridview to Jquery Datatable

Jun 8 2023 3:44 PM


  How to Convert Gridview to Jquery Datatable. I am getting below error

Uncaught TypeError: Cannot read properties of undefined (reading 'mData')
    at HTMLTableCellElement.<anonymous> (datatables.min.js:102:259)
    at Function.each (jquery.min.js:2:2573)
    at w.fn.init.each (jquery.min.js:2:1240)
    at HTMLTableElement.<anonymous> (datatables.min.js:102:214)
    at Function.each (jquery.min.js:2:2573)
    at w.fn.init.each (jquery.min.js:2:1240)
    at w.fn.init.n [as dataTable] (datatables.min.js:95:199)
    at h.fn.DataTable (datatables.min.js:177:488)
    at HTMLDocument.<anonymous> (AddRecommendedBooks:575:40)
    at l (jquery.min.js:2:29375)

                                        <asp:GridView ID="grdPlanning" class="table table-bordered" runat="server" onsorting="grdPlanning_Sorting" AllowSorting="True" OnRowDataBound="gr_RowDataBound" OnRowCommand="grdPlanning_RowCommand" AutoGenerateColumns="true">

<script type="text/javascript">
            $(function () {
                        bLengthChange: true,
                        lengthMenu: [[5, 10, -1], [5, 10, "All"]],
                        bFilter: true,
                        bSort: true,
                        bPaginate: true
grdPlanning.UseAccessibleHeader = true;
                    grdPlanning.HeaderRow.TableSection = TableRowSection.TableHeader;


Answers (1)