- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Data;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
-
- public partial class Default2 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
-
- if (!IsPostBack)
- {
- getdata();
- }
- }
- private void getdata()
- {
- string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
- SqlConnection con = new SqlConnection(constr);
- var commandStr = "select * from EmployeeData ";
-
- using (SqlCommand command = new SqlCommand(commandStr, con))
- {
- using (SqlDataAdapter sda = new SqlDataAdapter(command))
- {
- DataTable dt = new DataTable();
- sda.Fill(dt);
- GridView1.DataSource = dt;
- GridView1.DataBind();
- }
- }
-
- }
- protected void GridView_PreRender(object sender, EventArgs e)
- {
- GridView gv = (GridView)sender;
-
- if ((gv.ShowHeader == true && gv.Rows.Count > 0)
- || (gv.ShowHeaderWhenEmpty == true))
- {
-
- gv.HeaderRow.TableSection = TableRowSection.TableHeader;
- }
- if (gv.ShowFooter == true && gv.Rows.Count > 0)
- {
-
- gv.FooterRow.TableSection = TableRowSection.TableFooter;
- }
- }
-
- }
releated to the Bootstrap DataTable in the bellow link
https://jsfiddle.net/mmushtaq/q67L1a9a/