I've got myself a dataGrid which displays the data from a DataTable.
Not wanting to show all the columns in the grid I make use of the
following syntax :
string[] hideColumns = new string[]
{"Field3", "Field4", "Field5", "Field8", "Field9"}
dgtsMain = new DataGridTableStyle();
dataGrid1.TableStyles.Add(dgtsMain);
foreach (string fieldMapName in hideColumns)
{
dgtsMain.GridColumnStyles[fieldMapName].Width = 0;
}
This has worked OK but has now left me with a problem whereby the
hidden columns still maintain focus as I tab through them. I
obviously want to prevent this if I am able to.
Someone has suggested that I make use of the
dataGrid1.CurrentCellChanged event and resetting the CurrentCell
accordingly.
I have two blocks of hidden columns (3-5) and (8-9) so I may need to
pull some special trick ?
I'm lost as to how I might do this.
I'd like to make use of an array of strings that I'm using for the
setting of the columns widths (as above).
How might I go about doing this ?
Thanks in advance.
Steve
Not wanting to show all the columns in the grid I make use of the
following syntax :
string[] hideColumns = new string[]
{"Field3", "Field4", "Field5", "Field8", "Field9"}
dgtsMain = new DataGridTableStyle();
dataGrid1.TableStyles.Add(dgtsMain);
foreach (string fieldMapName in hideColumns)
{
dgtsMain.GridColumnStyles[fieldMapName].Width = 0;
}
This has worked OK but has now left me with a problem whereby the
hidden columns still maintain focus as I tab through them. I
obviously want to prevent this if I am able to.
Someone has suggested that I make use of the
dataGrid1.CurrentCellChanged event and resetting the CurrentCell
accordingly.
I have two blocks of hidden columns (3-5) and (8-9) so I may need to
pull some special trick ?
I'm lost as to how I might do this.
I'd like to make use of an array of strings that I'm using for the
setting of the columns widths (as above).
How might I go about doing this ?
Thanks in advance.
Steve