Forums - C# Corner

Forum guidelines
Nitish

Nitish

  • 759
  • 3
  • 6.4k

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)

Startup Conference 2016

SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.