Janus GridEx: Add custom row and select a specific row

Hossain Alhaidari picture Hossain Alhaidari · Sep 21, 2011 · Viewed 16.7k times · Source

I have GridEx object on my form and...

  1. I want to add some items in it with a for...next loop. Actually I couldn't find any method for adding a new row with a custom data.

  2. I want to select a specific row in that GridEx object. For example: I want to select the 6th row, is there anything like mygrid.rows(6).value or something like that?!

Thanks in Advance...

Answer

Ben Hoffstein picture Ben Hoffstein · Nov 17, 2011

Assuming you have a GridEX control called grid...

To add new data:

GridEXRow row = grid.AddItem();
row.BeginEdit();
row.Cells[0].Value = "Whatever"; // refer to columns by index or name
...
row.EndEdit();

To retrieve a specific row:

GridEXRow row = grid.GetRow(5); // returns the 6th row

To select a specific row:

grid.MoveTo(5); // moves the selection to the 6th row