protected void GridView1_PreRender(object sender, EventArgs e)
{
dtInv = objDataAccess.GetDataTable("select * from tbl_fin_Customerregistration");
GridView1.DataSource = dtInv; //GetData is your method that you will use to obtain the data you're populating the GridView with
GridView1.DataBind();
if (GridView1.Rows.Count > 0)
{
//Replace the <td> with <th> and adds the scope attribute
GridView1.UseAccessibleHeader = true;
//Adds the <thead> and <tbody> elements required for DataTables to work
GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
//Adds the <tfoot> element required for DataTables to work
GridView1.FooterRow.TableSection = TableRowSection.TableFooter;
}
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" width="100%" CssClass="table table-striped table-bordered table-hover gvv" OnPreRender="GridView1_PreRender" >
</asp:GridView>
<script language="javascript" type="text/jscript">
$(document).ready(function () {
$('#dataTables-example').DataTable({
responsive: true,
"lengthMenu": [[10, 25, 50, 100, 500, 1000, 1000000], [10, 25, 50, 100, 500, 1000, "All"]]
});
});
$(document).ready(function () {
$('.gvv').DataTable({
responsive: true,
"lengthMenu": [[10, 25, 50, 100, 500, 1000, 1000000], [10, 25, 50, 100, 500, 1000, "All"]]
});
});
</script>
{
dtInv = objDataAccess.GetDataTable("select * from tbl_fin_Customerregistration");
GridView1.DataSource = dtInv; //GetData is your method that you will use to obtain the data you're populating the GridView with
GridView1.DataBind();
if (GridView1.Rows.Count > 0)
{
//Replace the <td> with <th> and adds the scope attribute
GridView1.UseAccessibleHeader = true;
//Adds the <thead> and <tbody> elements required for DataTables to work
GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
//Adds the <tfoot> element required for DataTables to work
GridView1.FooterRow.TableSection = TableRowSection.TableFooter;
}
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" width="100%" CssClass="table table-striped table-bordered table-hover gvv" OnPreRender="GridView1_PreRender" >
</asp:GridView>
<script language="javascript" type="text/jscript">
$(document).ready(function () {
$('#dataTables-example').DataTable({
responsive: true,
"lengthMenu": [[10, 25, 50, 100, 500, 1000, 1000000], [10, 25, 50, 100, 500, 1000, "All"]]
});
});
$(document).ready(function () {
$('.gvv').DataTable({
responsive: true,
"lengthMenu": [[10, 25, 50, 100, 500, 1000, 1000000], [10, 25, 50, 100, 500, 1000, "All"]]
});
});
</script>
0 comments:
Post a Comment