AD
Administrator
Syncfusion Team
November 21, 2006 11:20 AM UTC
Hi Lokesh,
The following code states how to set the NegativeSign, NegativeColor and CurrencyNegativePattern of the currency cell in a grid. Please try this and let me know if you are looking something different.
Qualification.GridBoundColumns(GridColumns.ScheduledHours).StyleInfo.CurrencyEdit.NegativeColor = Color.Black
Qualification.GridBoundColumns(GridColumns.ScheduledHours).StyleInfo.CurrencyEdit.NegativeSign = string.Empty;
Qualification.GridBoundColumns(GridColumns.ScheduledHours).StyleInfo.CurrencyEdit.CurrencyNegativePattern = 1;
Best Regards,
Haneef
LO
Lokesh
November 21, 2006 12:05 PM UTC
Hello Haneef
Thanks for the Answer but I dont want the user to put any negative values . That means my grid cell should accept only positive values .
regards
lokesh
>Hi Lokesh,
The following code states how to set the NegativeSign, NegativeColor and CurrencyNegativePattern of the currency cell in a grid. Please try this and let me know if you are looking something different.
Qualification.GridBoundColumns(GridColumns.ScheduledHours).StyleInfo.CurrencyEdit.NegativeColor = Color.Black
Qualification.GridBoundColumns(GridColumns.ScheduledHours).StyleInfo.CurrencyEdit.NegativeSign = string.Empty;
Qualification.GridBoundColumns(GridColumns.ScheduledHours).StyleInfo.CurrencyEdit.CurrencyNegativePattern = 1;
Best Regards,
Haneef
AD
Administrator
Syncfusion Team
November 21, 2006 12:53 PM UTC
Hi Lokesh,
You can acess the GridCurrencyTextBox control and handle the CurrencyTextBox.KeyValidate event to cancel the '-' key in a currency cell. Here is a code snippet to show this.
private void gridDataBoundGrid1_CurrentCellControlGotFocus(object sender, ControlEventArgs e)
{
GridCurrencyTextBox cCurrencyTextBox = e.Control as GridCurrencyTextBox;
if( cCurrencyTextBox != null)
cCurrencyTextBox.KeyValidate +=new KeyValidateEventHandler(cCurrencyTextBox_KeyValidate);
}
private void cCurrencyTextBox_KeyValidate(object sender, KeyValidateEventArgs e)
{
if( e.Key == '-')
e.Cancel = true;
}
Best Regards,
Haneef