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

[Solved] Setting the tabindex for all of the elements of Pager

1 Answer 201 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 31 Dec 2009, 03:25 PM
How can I set the tabindex for each element of the pager?  I can do this for a couple of the elements but the documentation does not mention the names of ALL THE ELEMENTS of the pager.  Specifically I need to set the tabindex on the Next, Previous, First, Last and Numeric buttons.  

I need to override the default of '0' because I have a LinkButton column which for some reason receives focus after the pager elements.  I have set the tabindex to the LinkButton column elements to '0' but for some reason it's being bypassed. 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Jan 2010, 01:22 PM
Hello Robert,

I suppose you are using the NextPrevNumericAndAdvanced mode for the pager of your grid. If thats the case check out the code that I implemented to set the tab index for the various pager buttons:
c#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridPagerItem) 
        { 
            GridPagerItem pager = (GridPagerItem)e.Item; 
            ((System.Web.UI.WebControls.Button)(pager.FindControl("ctl02"))).TabIndex = 1; 
            ((System.Web.UI.WebControls.Button)(pager.FindControl("ctl03"))).TabIndex = 2; 
            ((System.Web.UI.WebControls.Button)(pager.FindControl("ctl14"))).TabIndex = 3; 
            ((System.Web.UI.WebControls.Button)(pager.FindControl("ctl15"))).TabIndex = 4; 
 
            short i = 5; 
            Panel panel = (Panel)pager.FindControl("ctl04"); 
            foreach (Control ctrl in panel.Controls) 
            { 
                (ctrl as LinkButton).TabIndex = i++; 
            }              
        } 
   } 

Hope this helps..
Princy.
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or