We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

New and need some help on basic problem.

I am new to SyncFusion and after looking around awhile I did not see a straightforward way of doing what seems to be a simple thing. I need to know how to set a cell to accept numeric data and set a specific range say 0 to 100 with 2 decimal places. I don''t need the decimal to show without typing it but if it does that is fine. I would also like to have a cell accept a date 01/01/2001 and set a range of min and max for the date 01/01/1970 - 01/01/2050. I would like the / to show in the cell. I was able to use the editmask for the date but didn''t know how to get the range set. Do I need to handle that in a validation event? I was not able to get the numeric cell working with the number of digits and decimal places that I wanted. Suprisingingly the thing I thought would be the most difficult, added a dropdown to a cell, was the easiest. Any help would be appreciated. Thank you, Jennifer

3 Replies

AD Administrator Syncfusion Team February 8, 2005 08:00 PM

Hi Jennifer, for a numeric cell with 2 digits you can set GridStyleInfo.CellValueType = typeof(double); and GridStyleInfo.Format = "0.00"; this works with the regular textbox cell type. The validation of the text can happen either when the user leaves the cell (CurrentCellValidating) or while the user types text (CurrentCellValidateString) into the cell. Regarding the date validation. Yes, that should be handled in the CurrentCellValidating event. Just set e.Cancel = true if you do not want to accept the data. Optionally you can set grid.CurrentCell.ErrorMessage. Stefan >I am new to SyncFusion and after looking around awhile I did not see a straightforward way of doing what seems to be a simple thing. > >I need to know how to set a cell to accept numeric data and set a specific range say 0 to 100 with 2 decimal places. I don''t need the decimal to show without typing it but if it does that is fine. > >I would also like to have a cell accept a date 01/01/2001 and set a range of min and max for the date 01/01/1970 - 01/01/2050. I would like the / to show in the cell. > >I was able to use the editmask for the date but didn''t know how to get the range set. Do I need to handle that in a validation event? I was not able to get the numeric cell working with the number of digits and decimal places that I wanted. Suprisingingly the thing I thought would be the most difficult, added a dropdown to a cell, was the easiest. > >Any help would be appreciated. > >Thank you, > >Jennifer


JM Jennifer Morgret February 9, 2005 07:02 PM

Thanks. That helps. The only problem I still have is that I might have two double cells, one Day of Year (1-365) and the other Number Of Items (0-999999). Although they are different cells they are both going to the same validation event and I don''t really have a way to distinguish which range to use in validation. I guess I will have to look at the identifier cell next to the input cell first. If you have any suggestions let me know. Thanks again. Jennifer


AD Administrator Syncfusion Team February 9, 2005 08:26 PM

Just check grid.CurrentCell.RowIndex and grid.CurrentCell.ColIndex. Stefan >Thanks. That helps. The only problem I still have is that I might have two double cells, one Day of Year (1-365) and the other Number Of Items (0-999999). Although they are different cells they are both going to the same validation event and I don''t really have a way to distinguish which range to use in validation. I guess I will have to look at the identifier cell next to the input cell first. If you have any suggestions let me know. > >Thanks again. > >Jennifer

Loader.
Live Chat Icon For mobile
Up arrow icon