DataGridView RowHeader Text
-
Hello everybody. I have a TabControl with two TabPages each contains one DatagridView control. I want that, when i click on a row in First Datagridview (Customers), Second DatagridView (Shopping List) refresh to show the according to that row. I can do this, but I want to show "Date of shopping" in second Datagridview RowHeader's Cell, When i'm going to TabPage2 i see all rows with empty RowHeade. But when i back to TabPage1 and change the row and back again to TabPage2 I can see RowHeader's value now! Why i should click on some rows of first to setting RowHeader's Value on second? How can i solve this?
dGridViewShopping.DataSource = ds; dGridViewShopping.DataMember = ds.Tables["tblShopping"].TableName; dGridViewShopping.Columns["date"].Visible = false; foreach (DataGridViewRow dgRow in dGridViewShopping.Rows) { if (dgRow.Index != dGridViewShopping.Rows.Count - 1) { dgRow.HeaderCell.Value = dgRow.Cells["date"].Value.ToString(); } }
Tanx