How to use gridview exports button in Jquery datatable
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" />
<link rel="stylesheet" href="../js/Ds_JDatatable.css" />
<script type="text/javascript" src="../js/DS_DtJquery.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.1/css/buttons.dataTables.min.css"></script>
<script src="https://cdn.datatables.net/buttons/1.6.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.1/js/buttons.html5.min.js"></script>
<script type="text/javascript">
$(function () {
$('[id$=Gv_list]').prepend($("<thead></thead>").append($('[id$=Gv_list]').find("tr:first"))).DataTable({
"responsive": true,
"ordering": false,
// "sPaginationType": "full_numbers",
"pagingType": "simple_numbers",
"lengthMenu": [10, 25, 50, 75, 100, 200, 500, 1000],
dom: 'Bfrtip',
buttons: [
'copyHtml5',
'excelHtml5',
'csvHtml5',
'pdfHtml5'
]
});
});
</script>
<asp:GridView ID="Gv_list" CssClass="display table table-bordered " runat="server" HeaderStyle-BackColor="#1183e0"
HeaderStyle-ForeColor="white" PageSize="20" ShowFooter="true" EmptyDataText="No Records Available!"
AllowPaging="true" AutoGenerateColumns="false" OnPageIndexChanging="Gv_list_PageIndexChanging">
<Columns>
<asp:TemplateField HeaderText="S.No" HeaderStyle-Width="90px">
<ItemTemplate>
<%#Container.DataItemIndex+1 %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Brand Name">
<ItemTemplate>
<asp:Label ID="lblname" runat="server" ToolTip="Brand Name" Text='<%#Eval("Brand_Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Brand Logo" ItemStyle-CssClass="text-center">
<ItemTemplate>
<asp:Image ID="brandlogo" runat="server" ToolTip="Brand Logo" ImageUrl='<%#Eval("ImagePath") %>'
Height="50px" Width="50px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status" HeaderStyle-Width="150px" ItemStyle-CssClass="text-center">
<ItemTemplate>
<asp:CheckBox ID="ChkIsActive" runat="server" Checked='<%#Eval("IsActive") %>' Enabled="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit" HeaderStyle-Width="90px" ItemStyle-CssClass="text-center">
<ItemTemplate>
<asp:ImageButton ID="lnkedit" OnClick="lnkedit_Click" CommandArgument='<%#Eval("Brand_Id") %>'
runat="server" ImageUrl="~/Process/img/edit.png" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete" HeaderStyle-Width="90px" ItemStyle-CssClass="text-center" Visible="false">
<ItemTemplate>
<UserControl:Confirm ID="ConfirmBox2" runat="server" TargetControlId="lnkdelete"
Title="Confirmation ....." Message="Do You Want To Delete Record ?" />
<asp:ImageButton ID="lnkdelete" OnClick="lnkdelete_Click" CommandArgument='<%#Eval("Brand_Id") %>'
runat="server" ImageUrl="~/Process/img/delete.png" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>