where are the possiblilites for using cutom modelbinding in asp.net mvc

Posted by Kasani007 under ASP.NET MVC on 11/23/2016 | Points: 10 | Views : 419 | Status : [Member] | Replies : 1
In What Type Of Situations We Have To Use Custom Model Binding In Asp.NET MVC Or ASP.NET WebApi




Responses

Posted by: Manicse on: 11/23/2016 [Member] Bronze | Points: 25

Up
0
Down
Hi,

The Model binder is responsible to map View Elements (HTML helpers) to the POCO model properties. It is the model binder which acts as a bridge between the View and the MVC models. Actually Model Binding is one of the best features in ASP.NET MVC framework. ModelBinder maps http requests from view data to the model.

We can see small examples like how it is effective and useful.

Controller
public ActionResult Index()  

{
return View();
}


Now we can create the Model File,

Public class DemoModel

{
public int StudentId { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public int Marks { get; set; }


}


Now we can Bind this model in the CSHTML file. Which is tightly coupled Datatype.


@model CustomModelBinding.Models.DemoModel 



Mani.R

Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response