Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am new to Devexpress. Now i need help from anybody to go ahead. I have a gridcontrol in a windows application. The Data inside the gridcontrol is unbounded using EntityFramework. There are plenty of columns inside it. There are two columns named AmountDroppped and TransactionAmount. I need to add another columns to display the difference between these columns and i wanna make reddish the whole row if this custom column value is greater than 400INR. Is there any way to do this without using code behind and stored procedure. Hope there might be a one.
Posted
Updated 9-Aug-14 20:11pm

 
Share this answer
 
C#
using DevExpress.XtraGrid.Columns;
//...
GridColumn columnDiff = new GridColumn();
columnDiff.FieldName = "amountDiff";
columnDiff.Caption = "Diff";
columnDiff.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
columnDiff.UnboundExpression = "[TransactionAmount] - [AmountDroppped]";
gridView1.Columns.Add(columnDiff);


To conditionally highlight some specific rows I suggest you use the Style Format Conditions feature:

C#
using DevExpress.XtraGrid;


StyleFormatCondition condition = new DevExpress.XtraGrid.StyleFormatCondition();
condition.Appearance.BackColor = Color.Red;
condition.Appearance.Options.UseBackColor = true;
condition.ApplyToRow = true;
condition.Condition = FormatConditionEnum.Expression;
condition.Expression = "([TransactionAmount] - [AmountDroppped]) > 400";
gridView1.FormatConditions.Add(condition);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900