Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tabbing through hidden Columns in a dataGrid

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
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



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top