Hi Jignesh,
Another means is use the DataGrid's PreRender event and set the
DataGrid.PagerStyle.Visible according to its current page count. e.g:
protected void dgPage_PreRender(object sender, EventArgs e)
{
if (dgPage.PageCount == 1)
{
dgPage.PagerStyle.Visible = false;
}
}
This can make our code just specific to the DataGrid without put in some
other page wide event.....
Hope helps. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Edwin Knoppert" <in**@pbsoft.speedlinq.nl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Subject: Re: ASP.NET:: Paging on Demand
| Date: Tue, 24 Jan 2006 22:11:50 +0100
| Organization: QinIP
| Lines: 117
| Message-ID: <dr**********@azure.qinip.net>
| References: <es**************@TK2MSFTNGP12.phx.gbl>
| NNTP-Posting-Host: h8441197235.dsl.speedlinq.nl
| Mime-Version: 1.0
| Content-Type: multipart/alternative;
| boundary="----=_NextPart_000_0016_01C62133.2D11FC80"
| X-Trace: azure.qinip.net 1138137108 8548 84.41.197.235 (24 Jan 2006
21:11:48 GMT)
| X-Complaints-To:
ab***@qinip.net
| NNTP-Posting-Date: Tue, 24 Jan 2006 21:11:48 +0000 (UTC)
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!newsfeed.freenet.de!213.132.189.2.MISMATCH!m ultikabel.net!feed20.multi
kabel.net!news2.euro.net!azure.qinip.net!not-for-mail
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:373273
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Agreed, but you can also extend this paging template with a checkbox to
disable it.
| I did a similar thing but outside the grid.
| "Jignesh Desai" <ji***********@hotmail.com> schreef in bericht
news:es**************@TK2MSFTNGP12.phx.gbl...
| Info::
| Most of you must have worked on paging feature of DataGrid. its works
fine as long as you have more no of records to show, but if you have
configured 20 records per page and no of records you retrieved is less then
20 then also pager gets rendered at the bottom of the grid showing "1".
most of us do not bother about it , but Clients ,,,uff...
| Solution:
| SQLDataAdapter.Fill(DS,"Emp")
| If DS.Tables("Emp").Rows.Count > MyDataGrid1.PageSize then
| MyDataGrid1.AllowPaging = True
| Else
| MyDataGrid1.AllowPaging = False
| End if
| MyDataGrid1.DataBind()
| Any better ways?
| ya perhaps this could have been reduced to one line also eg.
| MyDataGrid1.AllowPaging = ( DS.Tables("Emp").Rows.Count >
MyDataGrid1.PageSize )
| Anything better then this?
| Regards
| Jignesh Desai
|
www.dotnetjini.com
|