Nitish

Nitish

  • NA
  • 4
  • 13.7k

Paging in Gridview not working 2nd page data not showing ?

Mar 28 2013 3:57 AM
here my code
<div style="margin-left: 280px">
            <asp:GridView ID="exportGrdVw" runat="server" BackColor="White"  
        BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
        ForeColor="Black" GridLines="Vertical" AllowPaging="True" PageSize="3" 
                OnPageIndexChanging="exportGrdVw_PageIndexChanging" 
                onpageindexchanged="exportGrdVw_PageIndexChanged">
      protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            SqlDataAdapter da = new SqlDataAdapter("select customername,contactno,address from employee ", con);

            da.Fill(table);

            BindEmployee();
        }
    }
    public void BindEmployee()
    {

        exportGrdVw.DataSource = table;
        exportGrdVw.DataBind();

    }
protected void exportGrdVw_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        exportGrdVw.PageIndex = e.NewPageIndex;
        BindEmployee();
    }
the problem is gridview is displaying but when i click page 2. 2nd page data is not showing (blank).         

Answers (4)