Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Values not getting into the entity
Message
De
24/02/2016 09:13:08
 
 
À
23/02/2016 07:38:21
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 4.0
Divers
Thread ID:
01631867
Message ID:
01631958
Vues:
45
>Hi,
>
>I have a WPF MM.NET 2010 application. One form is not storing the values entered on the form to the underlying entity so when I save, I get the validation kicking in that the data cannot be null/empty. If I edit an existing record it works fine.
>
>I have this in the XAML file:
>
>
    <mmwpf:mmBusinessWindow.DataContext>
>        <SamaanSystems_IBC_Business:OutboundLIATRateEntity/>
>    </mmwpf:mmBusinessWindow.DataContext>
>
>The New button click has no code in it to override the default MM.net behaviour.
>
>When debugging, the values shown on the form do not match what is in the entity so it looks like the datacontext is being pulled out from underneath the form but I can't find anywhere that is resetting it (and I don't know how to check the current datacontext when debugging).
>
>Any help to push me towards solving this would be great.

I've narrowed this down a bit. My screen consists of two pages. The first page has a navigation grid and the second page shows the details of the selected item from the navigation grid.

My code has this in it:
        protected override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            base.Window_Loaded(sender, e);

            // Get the entities
            mmBindingList<OutboundLIATRateEntity> outboundLIATRate = this.OutboundLIATRate.GetAllOutboundLIATRates();
            this.DataContext = this.OutboundLIATRate.DataSet.Tables[this.OutboundLIATRate.TableName].DefaultView;
If I change that code to this:
        protected override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            base.Window_Loaded(sender, e);

            // Get the entities
            this.DataContext = this.OutboundLIATRate.GetAllOutboundLIATRates();
Then everything works, except that I need to show a value from a related table in the navigation grid and that column shows up blank, hence why I was using the DefaultView.

So my question is then how do I set things up properly so that the grid shows the column from the related table and the data entry values get stuck back into the entity when I need them to be so the save will work?
Frank.

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

Click here to load this message in the networking platform