This is a migrated thread and some comments may be shown as answers.
Multiple RadNumericTextBox - focus
1 Answer 36 Views
This is a migrated thread and some comments may be shown as answers.
Mansi
Top achievements
Rank 1
Mansi asked on 28 Sep 2011, 07:11 AM
Hi,

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?

1 Answer, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 30 Sep 2011, 01:10 PM
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.
Tags
Input
Asked by
Mansi
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Share this question
or