MVC Bind Attribute like [Bind(Exclude = "Name")] or [Bind(Include = "Address, Payment, EmailID")].
When we have an ASP.NET MVC View that accepts user input and posts those inputs to a server we have the option to use the built-in Model-binding features to provide more control and security, we can restrict the properties that are allowed to be bound automatically.
Let's look at my demo mode:
By default any "View" or UI which is associated with the above model can "Post" the data to the server for each and every property. Please Note: In case "StudentId" is the primary key and it has the auto-increment property at DB level then the DB Server will not accept your any data by "Post" for this property.
What if, at any point of time, management demands that you to stop accepting an "Address" property, either by new record entry or by editing an existing record, what will you do? What if you even don't know how many "Views" or UI are connected to this model. Then, fulfilling such a demand will be a headache for you.
There may be many ways to do this, and I would enjoy hearing your comments; please go ahead and post your input.





Shiv Ratan KumarPosted Jun 2, 2019, 11:49 PM
But this should work on Action Level.
Jorge Barros CabezasPosted Feb 1, 2017, 3:38 AM
Is there a way to use the bind attribute in a property, how can you achieve it?
Seshu ObbalareddyPosted Aug 19, 2016, 8:18 AM
Nice one
Tran Cong ThoPosted Nov 12, 2015, 8:41 PM
Great
Tina GargPosted Oct 17, 2012, 12:27 AM
Great..
Gaurav ChauhanPosted Oct 16, 2012, 11:38 PM
Nice article.
Sukesh MarlaPosted Oct 16, 2012, 11:34 PM
good one