Forums - C# Corner

Forum guidelines
Nitish

Nitish

  • 750
  • 3
  • 6.2k

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)

C# Corner Hyderabad Developer Conference

SPONSORED BY

Spire.Doc - Free .NET Word API
Use Spire.Doc to create, read, write, print, and convert word documents to OpenXML, RTF, TXT, XPS, EPUB, EMF, HTML, Image and PDF.