Documents

NextGrid & NextDBGrid

NextGrid

NextDBGrid

NextInspector

NextSheet

NextCollection

Misc

Labs

NextGrid .NET

NextGrid Dot Net Events

Related Articles:

Info
  • Skill:
  • Version: 1.0.0
  • Author: Bojan Nikolic
  • Created: 2011-02-06
  • Updated: 2011-02-24
NextGrid for .NET have many events, such as: SelectionChanged, BeforeEdit, CellColoring...

AfterEdit


Occur after editing with Inplace Editor is successfully finished (User press Enter, or click on some other cell to apply editing).

Table 1: AfterEdit parameters
Name Meaning
e Indicate CellEventArgs object with X and Y properties that represents editing cell coordinates
value Indicate value of text that will be applied to the cell


ApplyEditText


Occur before value of cell is transfered to Inplace Edit. It is a place where initial edit text may be changed before grid enters into edit state.

Table 2: ApplyEditText parameters
Name Meaning
e Indicate CellEventArgs object with X and Y properties that represents editing cell coordinates
ref value Indicate value of text that will be transfered into Inplace Edit, and that can be changed


Example:

private void nextGrid1_ApplyEditText(object sender,
        CellEventArgs e, ref string value)
{
        if (e.X == 2) // Third column
        {
                value   = "000"; // Add 000 at the end of number
        }
}


BeforeEdit


Occur before cell is going to be edited. It include ref Accept parameter which when set to false, it cancel editing (editing will not be started).

Table 3: BeforeEdit parameters
Name Meaning
e Indicate CellEventArgs object with X and Y properties that represents editing cell coordinates
ref accept When set to false, editing will be stopped.


private void nextGrid1_BeforeEdit(object sender, CellEventArgs e,
        ref bool accept)
{
        if (e.X = 3) accept = false;
}


CellChanged


Occur when Value property of NxGridCell is changed. Change may occur from code, or when value of cell is changed by using Inplace Editors.

Table 4: CellChanged parameters
Name Meaning
e Indicate CellEventArgs object with X and Y properties that represents editing cell coordinates


CellColoring


This event occur when Cell's background is going to be painted. With this event cell color may be set dynamically.

Table 5: CellColoring parameters
Name Meaning
e Indicate CellEventArgs object with X and Y properties that represents painting cell coordinates
selected Determine if currently painting cell is selected.
ref cellColor Determine and specify color of currently painting cell.
ref textColor Determine and specify text color in currently painting cell.
ref bottomGridColor Determine and specify color of bottom gird border of currently painting cell.
ref rightGridColor Determine and specify color of right grid border of currently painting cell.


In next example every second row is painted in different color, only if cell is not selected.

private void nextGrid1_CellColoring(object sender, CellEventArgs e,
        bool selected, ref Color cellColor, ref Color textColor,
        ref Color bottomGridColor, ref Color rightGridColor)
{
	if (!selected)
        {
        	if (e.Y % 2 == 0) cellColor = Color.CornflowerBlue;
        }
}

Was This Article Useful?

Only constructive comments, code contributions... will be publishes. Questions, non-official discussion will not be published.