Saturday, August 11, 2018

Gridview Paging


GRIDVIEW  PAGINING CONCEPT  :
Select  gridview and go to source and set following property

AllowPaging="True"

OnPageIndexChanging="GridView1_PageIndexChanging"


CODE 

using System.Data.SqlClient;
using System.Data;


protected void Button1_Click(object sender, EventArgs e)
    {

        BindProducts();

    }

protected void BindProducts()
    {
        string cs = @"PATH”;
        cn = new SqlConnection(cs);
        cn.Open();
      
        DataSet ds = new DataSet();
        string k = "select * from student";
        SqlDataAdapter adp = new SqlDataAdapter (k,cn);

        adp.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();

    }

protected void GridView1_PageIndexChanging(object sender,

GridViewPageEventArgs e)
    {

        GridView1.PageIndex = e.NewPageIndex;

        BindProducts();

    }





No comments:

Post a Comment

GRIDVIEW ON ROW DATA BOUND EVENT

 Database Create  Student : roll , name , city , cost  Fix 6 Value  in Database Record  ====================================================...