Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Having trouble wiht a child grid
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Having trouble wiht a child grid
Divers
Thread ID:
00910957
Message ID:
00910957
Vues:
60
I've got a nearly classic situation I stole right from the jumpstart where there is a child grid on the properties page of an mmMaintenanceForm. I placed a mmButtonNew on the form and set the BindingSource property. I then needed to pre-populate a couple of the columns with data specific to this form. I think the way I did it is pretty ugly, but it looks like this:

//Set defaults for new DataRow
dsDrugDose = oDrugDose.GetCurrentDataSet();
int rowNum = dsDrugDose.Tables["lkup_drug_dose"].Rows.Count - 1;
DataRow myRow = dsDrugDose.Tables["lkup_drug_dose"].Rows[rowNum];
myRow["Dose"] = "";
myRow["Default_Dose"] = 0;

this.grdForms.NavigateData(mmNavigate.Last);
this.grdForms.Focus();

Everything works except that when I add a new parent record, then add new child records without first saving the parent, I get constraint violations in the database. Is there a way I can force the parent record to be written to the db first? Adding new child records to an existing parent works great.

Also, if there is something a little more elegant for setting default values for columns in the new row, I'd love to use it!

Thanks in advance,
Mike
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform