I have a gridview which gets populated in the backend code. I am trying to implement paging now, but when I am trying my way, I am getting nothing. Here is my piece of code:
public void generateTable() { conn.ConnectionString = connString; SqlCommand comm = new SqlCommand("ViewBusinessInfo", conn); comm.CommandType = CommandType.StoredProcedure; comm.CommandTimeout = 2; try { conn.Open(); SqlDataReader rdr = comm.ExecuteReader(); if (rdr.HasRows) { gvAssociation.DataSource = rdr; gvAssociation.DataBind(); gvAssociation.AllowPaging = true; gvAssociation.PageSize = 10; rdr.Close(); } else { lblResult.Text = "No businesses found."; lblResult.Visible = true; } } catch { } finally { conn.Close(); } } Can anyone advice what am I doing wrong and I can't get the paging in the gridview? Thx in advance, Laziale
catchtocatch(Exception ex)so you can see if you are actually getting an exception. An emptycatchblock will hide your exception.