Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3555
Handling Group By Feature when grouping different columns
posted
I have the group by feature enabled on the wingrid control. However, when I
add a column to the grouping area, the following proedure fails.

My question is, do I have to write different procedures for each grouping
case? What is the most efficient way of handling this?
private void CalculateGridCells()

{

//Get Current Row

int CurrentRow = ultraGrid1.ActiveCell.Row.Index;

int CurrentCol = ultraGrid1.ActiveCell.Column.Index;


//Enable Cells Editing

DeactivateRows(false);


//Disable AfterCellUpdate Event

this.ultraGrid1.EventManager.SetEnabled(GridEventIds.AfterCellUpdate,
false);

try

{


switch (this.ultraGrid1.Rows[CurrentRow].Cells["Epi"].Value.ToString())

{

case "Input Prevalent Population":


ultraGrid1.Rows[CurrentRow + 2].Cells[CurrentCol].Value =
(int)ultraGrid1.Rows[CurrentRow].Cells[CurrentCol].Value *
(int)ultraGrid1.Rows[CurrentRow + 1].Cells[CurrentCol].Value;

ultraGrid1.Rows[CurrentRow + 4].Cells[CurrentCol].Value =
(int)ultraGrid1.Rows[CurrentRow + 2].Cells[CurrentCol].Value *
(int)ultraGrid1.Rows[CurrentRow + 3].Cells[CurrentCol].Value;

break;

case "DR Percentage Diagnosed":

ultraGrid1.Rows[CurrentRow + 1].Cells[CurrentCol].Value =
(int)ultraGrid1.Rows[CurrentRow].Cells[CurrentCol].Value *
(int)ultraGrid1.Rows[CurrentRow - 1].Cells[CurrentCol].Value;

ultraGrid1.Rows[CurrentRow + 3].Cells[CurrentCol].Value =
(int)ultraGrid1.Rows[CurrentRow + 1].Cells[CurrentCol].Value *
(int)ultraGrid1.Rows[CurrentRow + 2].Cells[CurrentCol].Value;

break;

case "DR Percentage Treated":

ultraGrid1.Rows[CurrentRow + 1].Cells[CurrentCol].Value =
(int)ultraGrid1.Rows[CurrentRow].Cells[CurrentCol].Value *
(int)ultraGrid1.Rows[CurrentRow - 1].Cells[CurrentCol].Value;

break;

default:

//dostuff;

break;

}

}

finally

{

this.ultraGrid1.EventManager.SetEnabled(GridEventIds.AfterCellUpdate, true);

DeactivateRows(true); //Lock Rows

}




}