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

How to prevent UP/DOWN keys from changing values in a GridNumericColumn editor

Description

How do I prevent the UP and DOWN arrows from changing the values while editing a GridNumericColumn in a RadGrid?

Solution

The GridNumericColumn implements a NumericTextBox when editing. The default behavior of the RadNumericTextBox is to increment or decrement values when the UP/DOWN arrow keys are pressed. To change that behavior, an External Column Editor can be used to provide additional configuration options.

The code below demonstrates how to configure an external column editor, and how to disable the UP/DOWN key behavior.

<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" AutoGenerateColumns="false">
    <MasterTableView EditMode="Batch">
        <Columns>
            <telerik:GridBoundColumn DataField="ID" />
            <telerik:GridNumericColumn DataField="Value" ColumnEditorID="NumericEditor" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

<telerik:GridNumericColumnEditor runat="server" ID="NumericEditor">
    <NumericTextBox runat="server" IncrementSettings-InterceptArrowKeys="false"></NumericTextBox>
</telerik:GridNumericColumnEditor>

See Also

In this article