Articles → ASP .NET GRIDVIEW → Page numbers not visible in gridview paging in asp.net

Page numbers not visible in gridview paging in asp.net




Introduction










<asp:GridView ID="gvEmployeeList" runat="server" AutoGenerateColumns="false" 
PageSize="2" AllowPaging="true"/>




DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("Data.xml"));
gvEmployeeList.DataSource = ds.Tables[0];
gvEmployeeList.DataBind();




protected void gvEmployeeList_PageIndexChanging(object sender, GridViewPageEventArgs e) {
  gvEmployeeList.PageIndex = e.NewPageIndex;
  BindData();
}




protected void gvEmployeeList_RowDataBound(object sender, GridViewRowEventArgs e) {
  e.Row.Cells[0].Visible = false;
}




Picture showing the datagrid without the page numbers in asp.net

Click to Enlarge




Reason and resolution




e.Row.Cells[0].Visible = false;






if (e.Row.RowType != DataControlRowType.Pager)        
    e.Row.Cells[0].Visible = false;



Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, July 5, 2011

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250