ASP.NET MVC3 Model Binding on Edit -
i'm working on 5th or asp.net mvc webapp in past few years, , still haven't seen way take data submitted in edit/update form , save database efficiently when using orm linq sql or entity framework.
just clear, problem create action can take object parameter:
public actionresult create(questiongroup newgroup)
with edit action, object must linked orm , updated, rather created scratch modelbinder do.
i have solved problem 1 of 2 ways: either manually update each property on object (one line of code per property) or write method uses reflection find every property update , copies value over.
i feel certain that, in version 3 of mvc, there blessed way better, cannot find it! what's secret more , gracefully??
well embarrassing... there method controller.updatemodel several overloads trick. searched internet hi , low, accidentally find answer intellisense right after posting question.
Comments
Post a Comment