Hide Datagrid paging when not needed

L

Logan McKinley

I have a datagrid that uses numeric paging and want to hide the paging when
it is not needed. Right now i only need paging 10% of the time or so and
the other 90% of the time there is a random 1 that confuses the users. Is
there any way to only show the paging when it is needed?
Thanks in advance,
~Logan
 
L

Logan McKinley

Thanks,
this is the code that worked for me
if(((DataSet)dgTest.DataSource).Tables[0].Rows.Count < dgTest.PageSize)
dgTest.AllowPaging = false;
 
P

Paul

Logan you need some logic in an event like the itemdatabound event or
something.

Get a row count each time the event fires. When it reaches the right
number do something like

DGName.PagerStyle.Visible = False

I haven't tried it but it seems pretty straight forward. You know what
the property is, and it's only a boolean. You can reset properties in
code behind at any event.


~Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top