I have model
public class MyModel
{
public string Name { get; set;}
}
I have html code
<div id="Name">Important data</div>
In Controller, i have a method
public ActionResult Index (MyModel model)
{
model.Name == "Important data"
}
Is it real, using standart model binder? thx)
The model binder parses request data into objects. When you use a
divthere’s no request data, nothing posted to the server. You could use a form with input fields in order to send request parameters that could be handled by the model binder and converted into object:Or use an anchor:
Another option would be to send the request using AJAX: