John
John

Reputation: 1499

MVC Model Error on TryUpdateModel()

I have an error (see below). At first glance it seems obvious to me, however. I've checked everything: the MODEL is ok; metadata class set ok and i've checked my controller and at the time 'TryUpdateMOdel' is called all is well and the object is as i expect it to be. I'm thinking this will be something silly but been stuck all day, anyone recommend anything?

The associated metadata type for type 'Lms.Model.PaymentFrequency' contains the following unknown properties or fields: SiteAgreementId, PaymentTypeId, PaymentCategoryId, ObligationStartDate, TerminationDate, Comments. Please make sure that the names of these members match the names of the properties on the main type.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The associated metadata type for type 'Lms.Model.PaymentFrequency' contains the following unknown properties or fields: SiteAgreementId, PaymentTypeId, PaymentCategoryId, ObligationStartDate, TerminationDate, Comments. Please make sure that the names of these members match the names of the properties on the main type.

Source Error:

Line 120:            PaymentFrequency paymentFrequency = this._siteRepository.GetPayment(Convert.ToInt16(collection["PaymentId"])).PaymentFrequency;
Line 121:
Line 122:            TryUpdateModel(paymentFrequency);
Line 123:
Line 124:            if (!ModelState.IsValid)

Upvotes: 0

Views: 1241

Answers (1)

Chad Moran
Chad Moran

Reputation: 12854

It sounds like the metadata class you have attached to your PaymentFrequency model may have properties the model itself doesn't.

Upvotes: 1

Related Questions