This is a migrated thread and some comments may be shown as answers.

MaxLength Property not working for GridNumericColumn

1 Answer 55 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Top achievements
Rank 1
Manny asked on 27 Jul 2017, 02:45 PM


I'm creating a grid programmatically and I want to set the MaxLength of a GridNumericColumn but it's not working. MinValue and MaxValue works, but not MaxLength. Please help.



1 Answer, 1 is accepted

Sort by
Telerik team
answered on 01 Aug 2017, 07:49 AM
Hello Manny,

Generally, this property should work as expected, the only exception being Batch editing, which is a tad different. You can access the generated numbox using the approach demonstrated here:

In this case it will be something like this:
Copy Code
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 approach is the following:
<telerik:GridNumericColumn ... ColumnEditorID="NumBoxEditor1">

Editor definition on the same page with the RadGrid:
<telerik:GridNumericColumnEditor runat="server" ID="NumBoxEditor1">
    <NumericTextBox runat="server">
        <IncrementSettings InterceptArrowKeys="false" InterceptMouseWheel="false" />

Instead of Intercept properties, just set the MaxLength and this should do the trick.

Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
General Discussions
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question