Datagrid won't refresh
I think the problem is in the index of the new rows but I could be
does anyone see where the problem is here?
//renumber the existing priorityID's in the lookup table
int firstIndex = RenumberPriorityID(frmAddLookupRow.StartingPriorit yID, true, frmAddLookupRow.NumberRows) + 2;
int nextPriorityID = frmAddLookupRow.StartingPriorityID;
// add the number or rows required to the lookup table
for (int counter = 0; counter < frmAddLookupRow.NumberRows; counter++)
{
TKData.TKSIMSLookupRow newLookupRow = tKData.TKSIMSLookup.NewTKSIMSLookupRow();
newLookupRow.SiteID = txt_VesselDetail_SiteID.Text;
newLookupRow.IMONumber = txt_VesselDetail_IMONumber.Text;
newLookupRow.VesselName = cboVessel.Text;
newLookupRow.ProjectName = cboProjectName.Text;
newLookupRow.SisterGroup = cboSisterGroup.Text;
newLookupRow.PriorityID = nextPriorityID;
newLookupRow.IsModified = false;
newLookupRow.ModDescription = "NA";
// tKData.Tables["TKSIMSLookup"].Rows.InsertAt(newLookupRow, firstIndex + counter);
tKData.Tables["TKSIMSLookup"].Rows.Add();
nextPriorityID = nextPriorityID + 1;
}
}
dgLookup.AutoGenerateColumns = false;
dgLookup.DataSource = tblLookup;
dgLookup.EndEdit();
dgLookup.Refresh();
}
|