
Raghavan Subramanian
Top achievements
Rank 1
Raghavan Subramanian
asked on 02 Oct 2009, 04:13 PM
Hi,
I want to disable the NextPage/PreviousPage buttons dynamically in Radgrid depends on the records in radgrid.
Please give any suggestions.
Thanks in advance.
Regards,
Rags
3 Answers, 1 is accepted
0
Accepted

Princy
Top achievements
Rank 2
answered on 05 Oct 2009, 12:28 PM
Hi Rags,
You can try out the following code to disable the next page/ previous page buttons:
c#:
Thanks
Princy.
You can try out the following code to disable the next page/ previous page buttons:
c#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridPagerItem) |
{ |
GridPagerItem pager = (GridPagerItem)e.Item; |
if (check for condition) |
{ |
((Button)pager.FindControl("ctl03")).Enabled = false; |
((Button)pager.FindControl("ctl12")).Enabled = false; |
} |
} |
} |
Thanks
Princy.
0

Somnath
Top achievements
Rank 1
answered on 17 Aug 2011, 10:03 AM
Hi,
To disable the last page and next page button I have used follwing code.
To disable the last page and next page button I have used follwing code.
((
Button)pagerItem.FindControl("ctl10")).Enabled = false;
((
Button)pagerItem.FindControl("ctl11")).Enabled = false;
But we cannot use because this ("ctl10") ID changes as number of pages increases.
Please suggest for the same.
0
Hi Ankit,
You could use jQuery in order to achieve your goal. Depending on your server logic, you could register client script that accesses the pager buttons using their class names and disables them:
All the best,
Tsvetina
the Telerik team
You could use jQuery in order to achieve your goal. Depending on your server logic, you could register client script that accesses the pager buttons using their class names and disables them:
function
pageLoad(sender, args){
$telerik.$(
'.rgPageNext'
)[0].disabled=
'true'
;
$telerik.$(
'.rgPagePrev'
)[0].disabled=
'true'
;
}
All the best,
Tsvetina
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>