Remove tab stop from RadNumericTextBox spin buttons

4 posts, 0 answers
  1. Drew
    Drew avatar
    13 posts
    Member since:
    Nov 2007

    Posted 02 Nov 2009 Link to this post


    I have multiple web pages that each contain 36 radNumericTextboxes on them.

    I want to disable the tab stop on the spin buttons for each of the controls. So far the only answer I can find is this:

    myControl.ButtonDownContainer.Attributes.Add("tabindex", "-1")
    myControl.ButtonUpContainer.Attributes.Add("tabindex", "-1")

    I don't want to have 72 lines of code on each of my 19 pages to do something that I should be able to do in a for each loop. However, I cant seem to implement the following code because the telerik controls dont exist in

    For Each myControl In Page.Controls
                If TypeOf myControl Is RadNumericTextBox Then
                    myControl.ButtonDownContainer.Attributes.Add("tabindex", "-1")
                    myControl.ButtonUpContainer.Attributes.Add("tabindex", "-1")
                End If

    So my question is, how can I return an array of all telerik controls contained on a page?

    Thank you,
  2. Dimo
    Dimo avatar
    8318 posts

    Posted 03 Nov 2009 Link to this post

    Hi Drew,

    Yes, the RadNumericTextBoxes do not reside in the Page.Controls collection. Page.Controls contains some LiteralControls and one HtmlForm control, nothing more. You can see that by debugging your code.

    In other words, you need to iterate through the page controls' collections recursively.

    Another approach is to apply the tabindex attribute client-side. This can be achieved by obtaining a collection of all <a> elements on the page, check whether any of them has a "riDown" or "riUp" CSS class and set the tabindex attribute.


    function setTabIndex()
        var hyperlinks = document.getElementsByTagName("a");
        for (var j = 0; j < hyperlinks.length; j++)
            if (hyperlinks[j].className.indexOf("riUp") != -1 || hyperlinks[j].className.indexOf("riDown") != -1)
                hyperlinks[j].setAttribute("tabindex", "-1");

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
  4. Drew
    Drew avatar
    13 posts
    Member since:
    Nov 2007

    Posted 03 Nov 2009 Link to this post


    My biggest problem was actually scope related.
    Any time I tried to reference anything on Me.Form.Controls or the system was only returning controls from the master page.

    I ended up fixing the problem by using this solution we came up with here:

    Dim cph As ContentPlaceHolder = CType(HttpContext.Current.Handler, Page).Form.FindControl("cph"
    For Each mycontrol As Control In cph.Controls  
       If TypeOf mycontrol Is Telerik.Web.UI.RadNumericTextBox Then 
          Dim ntb As RadNumericTextBox = DirectCast(mycontrol, RadNumericTextBox) 
       End If 

  5. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 29 Jun 2015 in reply to Drew Link to this post

    Thanks Drew,


    Yes, just add it in the _PreRender will also work fine:

    Dim ntb As RadNumericTextBox = DirectCast(mycontrol, RadNumericTextBox)
    ntb.ButtonDownContainer.Attributes.Add("tabindex", "-1")
    ntb.ButtonUpContainer.Attributes.Add("tabindex", "-1")


Back to Top