Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Jump start: Any Add example
Message
De
28/02/2010 16:06:13
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01451594
Message ID:
01451625
Vues:
26
Thanks. I've got a problem when adding records. My editing works fine, but when I save from an Add, I am getting back a Concurrency violation. I've tracked it down to a combobox on my form that maintains a list of options that are hard code, not pulled from a table, for example: Male or Female.

In my Save, I was setting the value of the Sex field to the SelectedValue of the combo, but that seems to trigger something in MM.NET to make it think it should run an Update rather than an Insert. So, I think the problem is how to configure the combo so that it uses a hard coded list, but gets bound to the datafield.

I have tried by setting the BindingValueSource to my Business Object and the Binding ValueSourceMember to the name of the field, but that doesn't seem to set the value in the dataset so I get a RuleBroken that this field cannot be empty.

How should I approach this?

>Frank,
>
>The code for saving is no different for adding a record vs. editing a record. But here it is:
>
>
> protected void btnSave_Click(object sender, EventArgs e)
>    {
>       
>        DataSet dsClient = (DataSet)Session["dsClient"];
>        if (this.Save(this.oClient, dsClient, this.oClient.TableName) == mmSaveDataResult.RulesPassed)
>            mmMessageDisplay.DisplayMessage("System Confirmation", "Record Successfully Saved",
>                "ClientsForm.aspx", 3);
>    }
>
>
>Note that I send the form back to the list form after successfully saving the record. If there were errors the edit form would remain with the error icons displayed.
>
>As far as unbound combos/dropdownlists, I am not sure what you mean. If these controls exist and they are not bound, what is their purpose? If they are bound to the business object then they will be part of the save process.
>
>>Hi Bob,
>>
>>that's pretty much exactly what I have. Can I see the code for saving? Also how do you handle unbound combos/dropdownlists?
>>
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform