Multiple RadNumericTextBox - focus

2 posts, 0 answers
  1. Mansi
    Mansi avatar
    63 posts
    Member since:
    Feb 2009

    Posted 28 Sep 2011 Link to this post


    I have a radGrid and in that there are multiple radNumeric textboxes. Please see attached image.
    The issue is of focusing next textbox.
    After selecting value in first textbox, I need to press tab key 3 times to focus the next textbox. It should be focused by just clicking one tab key. I know the reason that it renders two other hidden fields for numeric textboxes. But I need to disable the other two to focus the next one on just a single tab key press.

    <input id="ctl00_cphMainContent_gvFinalTest_ctl02_txtRound1_text" class="riTextBox riEnabled" type="text" style="width:100%;" name="ctl00_cphMainContent_gvFinalTest_ctl02_txtRound1_text">
    <input id="ctl00_cphMainContent_gvFinalTest_ctl02_txtRound1" class="rdfd_" type="text" title="" value="" style="visibility:hidden;float:right;margin:-18px 0 0 -1px;width:1px;height:1px;overflow:hidden;border:0;padding:0;">
    <input id="ctl00_cphMainContent_gvFinalTest_ctl02_txtRound1_Value" class="rdfd_" type="text" title="" value="" name="ctl00$cphMainContent$gvFinalTest$ctl02$txtRound1" style="visibility:hidden;float:right;margin:-18px 0 0 -1px;width:1px;height:1px;overflow:hidden;border:0;padding:0;">

    What is the solution for this issue?
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 30 Sep 2011 Link to this post

    Hello Mansi,

    You could handle the RadGrid's ItemCreated event and set the TabIndex of the RadNumericTextboxes, starting with 1, so that the TabIndex is explicitly set. Something like so: assuming you're RadNumericTextBox controls are in a GridTemplateColumn.

    short currentTabIndex = 0;
        protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
            if (e.Item is GridDataItem)
                GridDataItem grdItem = (GridDataItem)e.Item;
                RadNumericTextBox RadNumericTextBox1 = (RadNumericTextBox)grdItem["Column1"].FindControl("RadNumericTextBox1");
                RadNumericTextBox1.TabIndex = ++currentTabIndex;
                RadNumericTextBox RadNumericTextBox2 = (RadNumericTextBox)grdItem["Column2"].FindControl("RadNumericTextBox2");
                RadNumericTextBox2.TabIndex = ++currentTabIndex;
                RadNumericTextBox RadNumericTextBox3 = (RadNumericTextBox)grdItem["Column3"].FindControl("RadNumericTextBox3");
                RadNumericTextBox3.TabIndex = ++currentTabIndex;
                RadNumericTextBox RadNumericTextBox4 = (RadNumericTextBox)grdItem["Column4"].FindControl("RadNumericTextBox4");
                RadNumericTextBox4.TabIndex = ++currentTabIndex;
                RadNumericTextBox RadNumericTextBox5 = (RadNumericTextBox)grdItem["Column5"].FindControl("RadNumericTextBox5");
                RadNumericTextBox5.TabIndex = ++currentTabIndex;

    I hope that helps.
Back to Top