asp.net mvc - Model Binding not working in MVC 4 -


I have a form that I am posting in the following controller verb. But the currency value is meaningless. Why is not the model being binding? I used the same method in other forms and it used to work fine. I do not know why this is not working. ("edit")] [http post] edit public proceedingsCurrentTab (CURRENCY currency) // currency = null; {Dal Lib = new DAL (); Int state = lib.UpdateCurrency (currency); If (State == 1) {Return Redirect Action ("Details", new {id = Currency. ID}); } And {look back ("error"); }} See

// what I am posting:

  @Model Library. CURRENCY @ {ViewBag.Title = "EditCurrency_GET"; } & Lt; H2 & gt; EditingQuality_GET & lt; / H2 & gt; @using (Html.BeginForm ()) {@ Html.AntiForgeryToken () @ HTML.ValidationSummary (true) & lt; Fieldet & gt; & Lt; Story & gt; VFS_CURRENCY & lt; / Narrative & gt; @ Html.HiddenFor (model => model.ID) & lt; Div class = "editor-label" & gt; @HTML LabelFor (model = & gt; model.cURRENCY) & lt; / Div & gt; & Lt; Div class = "editor-field" & gt; @ Html.EditorFor (model => Model. CURRENCY) @ Html.ValidationMessageFor (model => Model. CURRENCY) & lt; / Div & gt; & Lt; Div class = "editor-label" & gt; @ Html.LabelFor (model = & gt; model.cURRENCY_SYMBOL) & lt; / Div & gt; & Lt; Div class = "editor-field" & gt; @ Html.EditorFor (model => model.cURRENCY_SYMBOL) @ Html.ValidationMessageFor (model => model.cURRENCY_SYMBOL) & lt; / Div & gt; & Lt; Div class = "editor-label" & gt; @ Html.LabelFor (model = & gt; model.cURRENCY_CODE) & lt; / Div & gt; & Lt; Div class = "editor-field" & gt; @ Html.EditorFor (model => model.cURRENCY_CODE) @html. Validation message (model = & gt; model. CURRENCY_CODE) & lt; / Div & gt; & Lt; Div class = "editor-label" & gt; @html.labelfor (model => model ISAVTIVE) & lt; / Div & gt; & Lt; Div class = "editor-field" & gt; @ Html.EditorFor (model => model.ISAVTIVE) @ html.ValidationMessageFor (model => model ISAVTIVE) & lt; / Div & gt; & Lt; Div class = "editor-label" & gt; @HTML LabelFor (model = & gt; model. DCCRPTN) & lt; / Div & gt; & Lt; Div class = "editor-field" & gt; @ Html.EditorFor (model => model.DESCRIPTION) @html. Validity message (model = & gt; model.DESCRIPTION) & lt; / Div & gt; & Lt; P & gt; & Lt; Input type = "submit" value = "save" /> & Lt; / P & gt; & Lt; / Fieldset & gt; }   

// My model

  the currency of the public partial square (public currency) {this.Country = new HashSet & lt; COUNTRY & gt; (); } Receive the public int id { Set; } Public string CURRENCY {get; Set; } Public string CURRENCY_SYMBOL {get; Set; } Public int CURRENCY_CODE {get; Set; } Public Bull ISAVTIVE {get; Set; } Public string DESCRIPTION {get; Set; } Public virtual iconging & lt; COUNTRY & gt; Country Set; }}    

In your controller the name of the model other than currency and name Try to give, that means amend the public proceeding: CURRENCYCurrency_POST (CURRENCY myCurrencyModel)

  edit public functioning Currency_DesignCurrency_POST (CURRENCY currency)   

to

  / code>  

Then one obviously turns the rest into the controller.

I think giving the name of the incoming variable is similar to your class and the underlying members of this class may have problems.

Comments

Popular posts from this blog

runtime error - Cannot find an overload for op_subtraction when subtracting datetime from datetime in powershell -

javascript - Backbone pushState routes -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -