I have a couple of questions regarding MaskEdit cells in a GridGroupingControl that are mapped to a property of an object that is a double.
I kind of pieced this code together based on snippets from this board and from examples:
GridColumnDescriptor descriptor = new GridColumnDescriptor("Number", "Number", "Number", false);
GridTableCellStyleInfo info = new GridTableCellStyleInfo();
info.CellType = GridCellTypeName.MaskEdit;
info.CellValueType = typeof (double);
info.ReadOnly = false;
info.MaskEdit.PaddingCharacter = '\0';
info.MaskEdit.PassivePromptCharacter = '\0';
info.MaskEdit.PromptCharacter = '\0';
info.MaskEdit.Mask = "###.00%";
GridTableCellAppearance appearance = new GridTableCellAppearance();
appearance.AnyRecordFieldCell = info;
appearance.RecordFieldCell = info;
appearance.AlternateRecordFieldCell = info;
descriptor.Appearance = appearance;
GridColumnDescriptorCollection collection = new GridColumnDescriptorCollection();
The idea is I want an editable grid bound to a list of business objects. One of the columns I want editable is bound to a double representing a percentage value. (The example I sent you uses a MaskEdit for cells in this column, but it may not stay that way.)
1) When I try to modify a cell in that column to 25%, I get a popup reading the following: "25.00% is not a valid value for a double." It appears that the value returned by the cell is the string "25.00%" and cannot be converted to the underlying double I want to store into. How can I get this value back into my underlying object represented by the given row? (Or is my approach all wrong?)
2) What I do like is the exclamation point next to my value indicating an invalid value. I do eventually want to validate the value of the modified cell, confirming it's between 0 and 100 percent. How can I do this, and do so without the popup, only the red exclamation point indicator?
Any insight would be greatly appreciated.