I need help to fix my code:
for (int P = 0; P < DataGridView.Rows.Count - 0; P++)
{
TNTDATADataContext Context = new TNTDATADataContext();
var q = (from C in Context.Customers
where C.Code == Code.Text && C.CompanyId == CompanyId
join TP in Context.TourProgrammes on C.PackageId equals TP.Id
select new { TP.DayId, TP.FromCityId, TP.ToCityId, TP.Programme }).First();
DataGridViewComboBoxCell DaysComboBoxCell = (DataGridViewComboBoxCell)DataGridView.Rows[P].Cells[0];
DaysComboBoxCell.Value = (object)q.DayId;
DataGridViewComboBoxCell FromCityComboBoxCell = (DataGridViewComboBoxCell)DataGridView.Rows[P].Cells[1];
FromCityComboBoxCell.Value = (object)q.FromCityId;
DataGridViewComboBoxCell ToCityComboBoxCell = (DataGridViewComboBoxCell)DataGridView.Rows[P].Cells[2];
ToCityComboBoxCell.Value = (object)q.ToCityId;
DataGridView["Programme", P].Value = (object)q.Programme;
}
This code is working well and bind a single value in DataGridViewComboBoxCell which I have bind by code.
There is a first snapshot
There you can see a area of tour programme where are 3 DataGridViewComboBoxCell in a DataGridView this is a before loading Customer Detail Snapshot now I've load a Customer Tour Details after entering code in Customer Code TextBox
Filed it showing all details but not showing rest of tour programme list in DataGridView its showing result in this second snapshot
I want a result like this third snapshot which I'm making manually for you can understand how can I want result after loading customer Tour detail's