Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Hierarchical data editing

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Hierarchical data editing
Link Posted: 15-Nov-2005 07:50
I'm dealing with data in a two-tier hierarchy, which I need to present to the user, but only allow editing of the lower tier. This would ideally involve setting the upper tier rows / nodes to readonly, or possibly setting cells within the nodes as readonly. However, I haven't discovered a method to handle this situation. Whatcha got?
Link Posted: 16-Nov-2005 07:43
You can set ReadOnly property of columns in the first level to true, in the second level to False:
[c#]
private void LockColumns(Columns cols, bool lock)
{
  foreach(Column col in cols.Items)
    col.ReadOnly = lock;
}

private void Init(FlyGrid flyGrid)
{
  //lock first level columns
  Columns cols = flyGrid.Columns;
  LockColumns(cols, true);
  //Get second level columns
  cols = cols.NestedColumns;
  //unlock second level columns
  LockColumns(cols, false);
  //get third level columns
  cols = cols.NestedCols;
  //lock third level columns
  LockColumns(cols, true);  
}