c# - I change the model values in the controller but the view receives the model with the old values -
i have action:
//edit [httppost] public actionresult invoicetype(clsinvoicetype model, string stade) { model.stade = stade== "1" ? true : false; homecoming partialview(model); }
in action seek alter value model.stade
, homecoming model view receive values sent action, problem seek alter value of model here in action , homecoming new model values view view receive original model values changes not working, problem?
how can alter original model values , send them view?
the modelstate
object contains values posted action method. html.*for()
helper methods in view pull values modelstate
before looking @ actual vaules in model. if want alter value need remove posted value modelstate
.
[httppost] public actionresult invoicetype(clsinvoicetype model, string stade) { this.modelstate.remove("stade"); // or .clear() remove keys model.stade = stade== "1" ? true : false; homecoming partialview(model); }
c# asp.net-mvc
No comments:
Post a Comment