How do I change the tab order of editable fields in a grid that has all fields open for editing (see attached image)? Specifically, how do I change from horizontal tabbing to vertical tabbing (see red numbers in attached image)? The text boxes are RadNumeric text boxes?
4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 31 Dec 2010, 07:25 AM
Hello,
Try to set the tab-index to the TextBox in the PreRender evenet like below.
C#:
Shinu.
Try to set the tab-index to the TextBox in the PreRender evenet like below.
C#:
protected void grdEmail_PreRender(object sender, EventArgs e) {Int16 i=1; foreach (GridColumn col in grdEmail.Columns) { if (col is GridBoundColumn) { foreach (GridEditableItem dataItem in grdEmail.MasterTableView.Items) { (dataItem[col.UniqueName].Controls[0] as TextBox).TabIndex = i;//setting the tabindex } } i++; }}Shinu.
0
WCRA Dev
Top achievements
Rank 1
answered on 03 Jan 2011, 06:18 PM
The control in the grid is a RadNumericTextBox and is the second column. I modified your example (see below) but I'm getting this error:
Object reference not set to an instance of an object
protected void gvGrossPayroll_PreRender(object sender, EventArgs e){ foreach (GridItem item in gvGrossPayroll.MasterTableView.Items) { if (item is GridEditableItem) { GridEditableItem editableItem = item as GridDataItem; editableItem.Edit = true; } } gvGrossPayroll.Rebind(); Int16 i = 1; foreach (GridColumn col in gvGrossPayroll.Columns) { if (col is GridBoundColumn) { foreach (GridEditableItem dataItem in gvGrossPayroll.MasterTableView.Items) { (dataItem[col.UniqueName].Controls[1] as RadNumericTextBox).TabIndex = i;//setting the tabindex } } i++; }}0
Shinu
Top achievements
Rank 2
answered on 04 Jan 2011, 06:13 AM
Hello Christian,
I suppose you are using GridNumericColumn. If so, you can try the following code.
aspx:
C#:
Thanks,
Shinu.
I suppose you are using GridNumericColumn. If so, you can try the following code.
aspx:
<telerik:GridNumericColumn DataField="EmployeeID" DataType="System.Int16" NumericType="Number" HeaderText="EmployeeID" UniqueName="EmployeeID"></telerik:GridNumericColumn>C#:
protected void grdEmail_PreRender(object sender, EventArgs e) { Int16 i=1; foreach (GridColumn col in grdEmail.Columns) { if (col is GridNumericColumn) { foreach (GridEditableItem dataItem in grdEmail.MasterTableView.Items) { (dataItem[col.UniqueName].Controls[0] as RadNumericTextBox).TabIndex = i; } } i++; } }Thanks,
Shinu.
0
WCRA Dev
Top achievements
Rank 1
answered on 04 Jan 2011, 03:14 PM
Thanks, that worked great.