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

GridViewCalculatorColumn Maxlength

1 Answer 178 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ismail
Top achievements
Rank 1
Ismail asked on 21 Jan 2017, 07:59 AM

Hi all,

I have a radgridview with two GridViewCalculator columns. The database table columns to which the data from these calculator columns goes, has the datatype like this : decimal(22,9). Here the gridview columns accept about 31 characters and in turn this will make runtime errors. How can I set the maxlength property for these calculator columns like we set the same for textbox columns? Pls help..

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 23 Jan 2017, 12:10 PM
Hello Ismail,

Thank you for writing.  

In order to specify the MaxLength property of RadCalculatorEditor, it is necessary to handle the CellEditorInitialized event and use the following code snippet:
private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadCalculatorEditor editor = e.ActiveEditor as RadCalculatorEditor;
    if (editor != null)
    {
        RadCalculatorEditorElement element = editor.EditorElement as RadCalculatorEditorElement;
        element.EditorContentElement.TextBoxItem.MaxLength = 5;
    }
}

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
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
GridView
Asked by
Ismail
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or