New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Prevent arrow keys changing numeric values in Batch Edit and Keyboard Navigation

Description

The increment settings of RadNumericTextBox are enabled by default for better convenience when operating with the input control. You can access the control and disable the arrow navigation of the numbox itself using the approach demonstrated in the following section:

http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-controls-in-batch-edit-mode

Solution

To resolve that, you can use the PreRender event of the Grid to disable intercepting user events in the Numeric TextBox.

<telerik:RadGrid ID="RadGrid1" runat="server" OnPreRender="RadGrid1_PreRender">

The PreRender event handler

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    GridTableView masterTable = ((RadGrid)sender).MasterTableView;
    GridNumericColumnEditor editor = masterTable.GetBatchColumnEditor("Freight") as GridNumericColumnEditor;
    RadNumericTextBox numBox = editor.NumericTextBox;
    numBox.IncrementSettings.InterceptArrowKeys = false;
    numBox.IncrementSettings.InterceptMouseWheel = false;
}

An alternative solution would be to use an external custom editor:

<telerik:GridNumericColumnEditor runat="server" ID="NumBoxEditor1">
    <NumericTextBox runat="server">
        <IncrementSettings InterceptArrowKeys="false" InterceptMouseWheel="false" />
    </NumericTextBox>
</telerik:GridNumericColumnEditor>

And then set it in the column definition:

<telerik:GridNumericColumn ... ColumnEditorID="NumBoxEditor1">
In this article
Not finding the help you need? Improve this article