This is a migrated thread and some comments may be shown as answers.

Disabling RadGrid pagination buttons

1 Answer 185 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lauren
Top achievements
Rank 1
Lauren asked on 12 Mar 2012, 04:32 PM
Hello,

We are currently using the Telerik RadGrid as part of our web application. Our application goes through Section 508 testing and one of the issues that came up was the fact that the pagination buttons are still enabled even if they don't have a function. For example, if there is only 1 page of results the "Next" and "Previous" type of buttons are selectable and still look enabled, yet they have no function. This is confusing for a screen reader user.

Is there an attribute or event handler that the pagination has to let us know when the pagination buttons have no functionality? We would like to detect if the buttons won't have an action and then programmatically disable them so that they are no longer selectable.

Thank you!

Lauren Jones

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 15 Mar 2012, 03:10 PM
Hi,

You could try to hook the PreRender event of RadGrid and in its body you could check whether the PageCount property returns one and then you could set the Visible property of the pager item to false, namely:

C#
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (RadGrid1.MasterTableView.PageCount == 1)
    {
        RadGrid1.MasterTableView.PagerStyle.Visible = false;
    }
    else
    {
        RadGrid1.MasterTableView.PagerStyle.Visible = true;
    }
}

VB.NET

Protected Sub RadGrid1_PreRender(sender As Object, e As EventArgs)Handles RadGrird1.PreRender
    If RadGrid1.MasterTableView.PageCount = 1 Then
        RadGrid1.MasterTableView.PagerStyle.Visible = False
    Else
        RadGrid1.MasterTableView.PagerStyle.Visible = True
    End If
End Sub

Give this approach a try and check whether this is the desired behavior.

Regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Lauren
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or