What is the purpose of the code behind view file in ASP.NET MVC besides setting of the generic parameter of ViewPage ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s my list of reasons why code-behind can be useful taken from my own post. I’m sure there are many more.
Yes! Some views should not need codebehind at all.
Yes! It sucks to get a stupid .designer file created in addition to .cs file.
Yes! Its kind of annoying to get those little + signs next to each view.
BUT – It’s really not that hard to NOT put data access logic in the code-behind.
They are most certainly NOT evil.