What is model binding in ASP.NET MVC? -
what model binding in asp.net mvc, why needed? can give simple example , can model binding achieved checking create typed view?
modelbinding mechanism asp.net mvc uses create strongly-typed objects (or fill primitive-type parameters) input stream (usually http request).
for example, consider person model:
public class person { public string name { get; set; } public int age { get; set; } } now, have action in controller that's expecting person type parameter:
public class homecontroller : controller { public actionresult editpersondetails(person person) { // ... } } the model-binder responsible fill person parameter you. default consulting valueproviders collection , asking value of each property in (to bound) model.
more on value-providers , model-binders on http://haacked.com/archive/2011/06/30/whatrsquos-the-difference-between-a-value-provider-and-model-binder.aspx/
Comments
Post a Comment