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
close icon

Restricting , in a particular column ... in Percentage Column

Hi,
We are using using percentage columns.
here if we enter 0.02 in cell the output is 2%.

If we enter 0,1 it is showing 100% on screen.

We want to restrict user from this, how can we proceed pls suggest.

we are using 3.x version.
Please suggest solution for that version as we cannot upgrade our project with latest version from yourside.

Thanks
Vinay

3 Replies

AD Administrator Syncfusion Team August 3, 2006 12:04 PM UTC

Hi Vinay,

Try handling the TableControlCurrentCellKeyPress event of the gridGroupingControl to achieve this. Here is the code snippet.

GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex);
if( style.TableCellIdentity.Column.MappingName == "PercentageColumn" )
{
if(e.Inner.KeyChar == '','')
e.Inner.Handled = true;
}

Let me know if this helps.
Regards,
Rajagopal


VI Vinay August 3, 2006 02:20 PM UTC

Hi Gopal,

This will not solve my problem.
we are restricting all the differtent columns types at a single place.

here we are using
gcd(Grid Column Descriptor)
gcd.Appearance.AnyRecordFieldCell.Format="### ### ##0";
gcd.Appearance.AnyRecordFieldCell.ValidateValue.Minimum
gcd.Appearance.AnyRecordFieldCell.ValidateValue.Maximum

Here I need to restrict entry for ","(Comma) and allow "."(Dot)

Thanks
Vinay


>Hi Vinay,

Try handling the TableControlCurrentCellKeyPress event of the gridGroupingControl to achieve this. Here is the code snippet.

GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex);
if( style.TableCellIdentity.Column.MappingName == "PercentageColumn" )
{
if(e.Inner.KeyChar == '','')
e.Inner.Handled = true;
}

Let me know if this helps.
Regards,
Rajagopal


AD Administrator Syncfusion Team August 4, 2006 12:02 PM UTC

Hi Vinay,

Instead of checking for any particular column in the TableControlCurrentCellKeyPress event hanlder, just check for the comma key press and handle the event.

if(e.Inner.KeyChar == '','')
{
e.Inner.Handled = true;
}

Let us know if this helps.
Thanks,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon