Search code examples
c#gridviewdatapager

hiding datapager in GridView when page number =1


I'm using gridview , and a datapager in it , I couldn't find a way to hide the pager. I tried this code :

pager.Visible = (pager.PageSize < pager.TotalRowCount); 

Is there any other way to achieve it ?


Solution

  • You can use this code if you add it in the OnDataBound event

    protected void GridView1_DataBound(object sender, EventArgs e)
    {
         pager.Visible = (pager.PageSize < pager.TotalRowCount); 
    }