Can someone shed some light on the use of the 'Bind' modifier in the following method signature?
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "List of model propertires.....")] MyModel model)
{
}
Can I use it to bind the posted values to a different model than the one I built the view with?
Thanks.
Yes you can use the Bind to bind the values to a different model. The Bind Attribute lets you specify the exact properties a model binder should include in the binding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With