Data Table (searchable concept) in gridview

Data table provide serchable concept in gridview. it has predefined library. add links in head tag add script in body tag File DATA TABLE STEP-1 COPY DATABLE FOLDER INSIDE THE PROJECT ROOT FOLDER STEP-2 INCLUDE FOLLOWING LINK INSIDE THE TAG Body Section
C# code using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Data; public partial class dtable : System.Web.UI.Page { SqlConnection cn; SqlCommand cm; SqlDataReader dr; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { show(); } } protected void show() { string cs = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\college.mdf;Integrated Security=True"; cn = new SqlConnection(cs); cn.Open(); cm = new SqlCommand("select * from student", cn); DataSet ds = new DataSet(); SqlDataAdapter sda = new SqlDataAdapter(); cm.Connection = cn; sda.SelectCommand = cm; DataTable dt = new DataTable(); sda.Fill(ds); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } }

Comments

Popular Posts