How to do view 2nd page in paging

72 Views Asked by At

I am able to view 1st page upon search but if data is more than 10 rows than its showing me full grid bind.

How can i view the 2nd page

 public void fncfillApplication()
    {
        try
        {


            DataSet ds = new DataSet();
            ds.ReadXml(Server.MapPath("Application.xml"));
            if (ds.Tables[0].Rows.Count != 0)
            {
                gvApplication.DataSource = ds;
                gvApplication.DataBind();

            }


        }
        catch (Exception ex)
        {
            ex.Message.ToString();

        }

On page index I am applying paging and my datasource is xml

 protected void OnPageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvApplication.PageIndex = e.NewPageIndex;
       this.fncfillApplication();
    }

I am able to view my 1 st page when doing paging by clicking 1 but when click on 2nd page i get my full grid bind.

How would I able to see data further if PageSize="10" but data in grid is 20 rows.How to see last 10 rows.

1

There are 1 best solutions below

1
On

Set properties-

EnablePaging

EnablePaging property to True to get GridView Paging.

PageSize

Number of rows from the data source to display per page.