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

MaxLength Property not working for GridNumericColumn

1 Answer 111 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.
Manny
Top achievements
Rank 1
Manny asked on 27 Jul 2017, 02:45 PM

Hi,

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.

Thanks

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Eyup
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:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-controls-in-batch-edit-mode


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" />
    </NumericTextBox>
</telerik:GridNumericColumnEditor>

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


Regards,
Eyup
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.
Tags
General Discussions
Asked by
Manny
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or