asp.net mvc - ASP.MVC ModelBinding Behaviour -


Despite the many posts on this has me stumped.

The scenario is a basic MVC (2) web application with simple CRUD operation. When called editing form is submitted and Apdetmodl () is throwing an exception:

System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException user was rejected by the code

This is against a DropDownList value that is a foreign key on the entity table. However, there is a drop-down list on the form, which is represented by another foreign key, an error (surprisingly) not exert edit to change manually values ​​of the assets within the action:

  recipe recipe = repository Gate recipes (int. Purse (form-value ["recipe"])); Recipe.CategoryId = Convert.ToInt32 (Form-Value ["Cd"]. ToString ()); Recipe.Page = int.Parse (formValues ​​["page"]. ToString ()); Recipe.PublicationId = Convert.ToInt32 (. FormValues ​​["PublicationId"] ToString ());  

Allows to update category id and page properties, and then an error is placed on PublicationId.

Any light shed will be most welcome on this.

There is nothing in this error with model binding. Instead, it is strictly related to SQL from SQL. You can find the proper details of the reasons.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -