Bootstrap DataTable in GridView with Updatepanel not applied after postback in ASP.Net

Last Reply on Apr 07, 2017 04:42 AM By dharmendr

Posted on Apr 07, 2017 02:05 AM

Bootstrap datatable applied successfully to gridview but problem is when i click edit button in gridview the datatable controls disappears!

Please help me...

Posted on Apr 07, 2017 04:42 AM

Hi YacharuP,

Add the below line of code at the end of the section in the page for update panel refresh to work.

<script type="text/javascript">
    //On UpdatePanel Refresh
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if (prm != null) {
        prm.add_endRequest(function (sender, e) {
            if (sender._postBackSettings.panelsToUpdate != null) {
                $('[id$=grd_dist_master]').prepend($("<thead></thead>").append($('[id$=grd_dist_master]').find("tr:first"))).DataTable({
                    "responsive": true,
                    "sPaginationType": "full_numbers"
                });
            }
        });
    };
</script>

For more details refer the below article.

Call JavaScript function after AJAX UpdatePanel Refresh (Partial PostBack) in ASP.Net