User (Old forums)MemberMay 4, 2007 at 10:03 amPost count: 23064
1. how do i add summary row in a bound grid ?
2. how can i format a cell or row in a bound grid based on the value of the cell?
Imported from legacy forums. Posted by PETE (had 3995 views)User (Old forums)MemberMay 4, 2007 at 12:33 pmPost count: 23064
1- Simply add a summary row either in the designer or in code, and you can add it to the collection of rows you want, that is, to the fixed header rows of the grid, the footer rows of a group, the footer rows of a detail grid, etc…
SummaryRow summaryRow1 = new SummaryRow();
gridControl1.FixedHeaderRow.Add( summaryRow1 );
2- Use the ValueChanged event on cells, and use the sender to change the format accordingly to the value.
private void Form1_Load(object sender, System.EventArgs e)
foreach( Cell cell in dataRowTemplate1.Cells )
cell.ValueChanged += new EventHandler( cell_ValueChanged );
void cell_ValueChanged( object sender, EventArgs e )
DataCell cell = sender as DataCell;
if( cell != null )
cell.ForeColor = Color.Red;
cell.BackColor = Color.Blue;
Imported from legacy forums. Posted by André (had 339 views)User (Old forums)MemberMay 5, 2007 at 11:23 amPost count: 23064
thats fine. i got the logic.
But i am having difficulties in converting this to vb.net.
Can you gime an example in vb.net pls
Imported from legacy forums. Posted by PETE (had 542 views)User (Old forums)MemberMay 7, 2007 at 2:10 pmPost count: 23064
Here is the corresponding code in VB.NET. Note however that there is bug in the present version of the grid (3.6.7204.19000) which makes this code not work. The bug is already fixed, but it will be available only in version 3.6.7213.0 and up, which will part of the next installation package to be available <a href=”http://xceed.com/pages/TopMenu/Downloads/Updates.aspx?Lang=EN-CA”>here</a>.
Dim cell As Cell
For Each cell In dataRowTemplate1.Cells
AddHandler cell.ValueChanged, AddressOf Me.Cell_ValueChanged
Private Sub Cell_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim cell As DataCell = CType(sender, DataCell)
If Not (cell Is Nothing) Then
cell.ForeColor = Color.Red
cell.BackColor = Color.Blue
Imported from legacy forums. Posted by André (had 307 views)User (Old forums)MemberMay 9, 2007 at 2:37 amPost count: 23064
Thorwing following exception:
An unhandled exception of type ‘System.StackOverflowException’ occurred in Xceed.Grid.dll.
Imported from legacy forums. Posted by PETE (had 535 views)User (Old forums)MemberMay 9, 2007 at 3:05 pmPost count: 23064
That is the exception I was referring to when saying “there is bug in the present version”. You will need to wait for the next version to be released to be able to implement this.
Imported from legacy forums. Posted by André (had 4970 views)
- You must be logged in to reply to this topic.