As far as I can tell, the "PercentTextBox" doesn't appear to be a supported celltype. In a future release, could you add support for this?
Also, in a future release, would it be possible to use an enumeration for the supported cell types to avoid typos and to get intellisense support for the availabe types we can specify?
ADAdministrator Syncfusion Team September 15, 2003 11:47 AM
I will add your percent cell type to our request list.
Making the celltype an enum will make it more difficult to add your own custom cell types. Right now, all you have to do is to use a new string to add a custom celltype.
You can get the % to show in a cell by just setting the GridStyleInfo.CellValueType to, say, double, and setting the GridStyleInfo.Format to "P". This would let you type 1 and see 100 %, or type .01 and see 1 %.
If you want to get the editing to recognized the entry of a % sign, then you can do this at the grid level by handling the SaveCellInfo event and the CurrentCellValidating event. Attached is a sample that does this. You do not have to set any formats in the style with this approach.
PLPaul LaudemanSeptember 16, 2003 07:27 AM
Thanks for the comment about the enumeration being limitng - I didn't consider that because I haven't started creating my ownn custom cell types. If that's the case, and there isn't a better workaround, then it might be better to leave it alone.
I managed to figure out the event handlers for the cells on my own, but thanks anyway for the code sample. Part of the problem was our users expect that when they say, enter 22, the grid would take that to mean 22% instead of 2200%. I just worked around that by dividing the value entered by 100 (in case anyone else wants to know).
In general, do you have a reference you could point me to that lists what the order of events are for a cell (from beginning to end). I couldn't seem to locate this information in the documentation, and it might be helpful to know for the future.
ADAdministrator Syncfusion Team September 16, 2003 08:30 AM
Take a look at the samples in the Syncfusion\Essential Suite\Grid\Samples\CellTypes folder. All of them allow you to display the evenst as tehy happen when you do things like type into a cell, and meove to another one.
For more general events, if you have the source code for the Essential Grid, you can use the Assembly Manager to build a debug version of the library. With debug builds, you can include a exe.config file with the correct switches in your EXE folder to have the grid generate debug output showing things like events being hit. Here is a sample.
Now in the GridPad sample config file, a lot of the switches have an 's' or 'x' in front of them. This effectively turns off that particular tracing. Remove these extra characters if you want to their output in the trace.
To see all the possible switches, look in the switches.cs file found in the grid's src folder.