Forums - C# Corner

Forum guidelines


  • 0
  • 4
  • 7.1k

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

Mar 28 2013 3:57 AM
here my code
 style="margin-left: 280px">  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 (3)

Unlimited Flat-Free License


File APIs for .NET
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!