MaxLength Property not working for GridNumericColumn

2 posts, 1 answers
  1. Manny
    Manny avatar
    2 posts
    Member since:
    Apr 2017

    Posted 27 Jul Link to this post

    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

     

  2. Answer
    Eyup
    Admin
    Eyup avatar
    3298 posts

    Posted 01 Aug Link to this post

    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.
Back to Top