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

GridViewDecimalColumn Custom Editor

1 Answer 169 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Evan
Top achievements
Rank 1
Evan asked on 28 Mar 2014, 05:41 PM
I have a class called RadSpinEditorWithValidation which inherits from GridSpinEditor.  It contains additional functionality like range checking, turning the background to a different color if the validation fails etc.  I have added the EditorRequired event handler as follows:

private void m_grd_NewDetectors_EditorRequired(object sender, EditorRequiredEventArgs e)
{
     if (e.EditorType == typeof(GridSpinEditor))
     {
          e.EditorType = typeof(RadSpinEditorWithValidation);
     }
}

How do I give the editor instance the min value and max value, among other things?  Here it looks like it auto-instantiates an instance from the type (Activator?) I have to be able to access the instance of the editor and feed it some values so it knows what to do.

Thanks,

Evan

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 02 Apr 2014, 08:34 AM
Hello Evan,

Thank you for writing.

You should use the CellEditorInitialized event to change any properties of the corresponding editor. For example, you can set maximum and minimum values for the default spin editor like this:
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    if (e.ActiveEditor is GridSpinEditor)
    {
        GridSpinEditor editor = e.ActiveEditor as GridSpinEditor;
        editor.MaxValue = 100;
        editor.MinValue = 0;
    }
     
}

More information about this event can be found in the following article: Handling Editors' events.
 
Please let me know if there is something else I can help you with. 

Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Evan
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or