Clear (Reset) jQuery DataTable Search Textbox value on Page Load in jQuery

Last Reply 4 months ago By dharmendr

Posted 5 months ago

I have refer the below link for Gridview search and filter operation.

How to clear the value of Search Textbox value on pageload

GridView CRUD operation using Bootstrap DataTable plugin in ASP.Net

How to call search() in that script. below is the script and my code. If there is any other solution please suggest.

    <link href="css/datatables_css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.12.4.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('[id*=grdDetails]').prepend($("<thead></thead>").append($(this).find("tr:first"))).DataTable({
                "responsive": false,
                "sPaginationType": "full_numbers",
                "bPaginate": true,
                "bSort": true,
                "iDisplayLength": 10,
                "stateSave": true,
                "stateDuration": 60 * 1
            });
        });
        //On UpdatePanel Refresh.
        var prm = Sys.WebForms.PageRequestManager.getInstance();
        if (prm != null) {
            prm.add_endRequest(function (sender, e) {
                if (sender._postBackSettings.panelsToUpdate != null) {
                    $('[id*=grdDetails]').prepend($("<thead></thead>").append($('[id*=grdDetails]').find("tr:first"))).DataTable({
                        "responsive": false,
                        "sPaginationType": "full_numbers",
                        "bPaginate": true,
                        "bSort": true,
                        "iDisplayLength": 10,
                        "stateSave": true,
                        "stateDuration": 60 * 1
                    });
                }
            });
        };
    </script>

 

This question does not have replies that have been liked.