Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 335515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:09:21+00:00 2026-05-12T10:09:21+00:00

I prefer strongly typed viewdata for my asp.net mvc views for various reasons and

  • 0

I prefer strongly typed viewdata for my asp.net mvc views for various reasons and I actually preferred the Views with codebehinds as they were in the earlier asp.net mvc previews because the codehind was a natural place to define the poco viewdata class as they generally have a 1:1 relationship with the actual view.

Are there any way to have the codebehind in asp.net rtm views or is this not a good approach?

EDIT:
The only reason I would like to have codebehind is that I see the ViewData as a property of the view. If the view was a class then the ViewData was one of its properties and it feels un-natural to define this in a separate assembly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:09:22+00:00Added an answer on May 12, 2026 at 10:09 am

    After almost a year together with MVC I can confirm I have not needed code-behind for views even once. If you use code-behind you’re likely still thinking WebForms. Drop it.

    Views should be there to just display the model data. Simple decisions like what CSS class to apply can be performed directly in the view within server tags. More complex decisions should go to the controller or business logic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Keywords: asp.net mvc 3, checkbox list, strongly typed view. So, please don't suggest me
To begin with: Using Entity Framework v4.0. ASP.NET MVC 2.0. Visual Studio 2010. I
In .NET you can create strongly-typed configuration sections using build-in base classes that do
It appears that, in .NET, array of enum is not a strongly-typed concept. MyEnum[]
In some instances, I prefer working with custom objects instead of strongly typed datasets
I have an ASP.Net application. It is an application where people fill out forms.
Is there any way to have a strongly typed UpdateModel(myEntity, MagicStringPrefix) without the magic
I am quite new to MVC 3. I know how to send a strongly
Would prefer an answer in C#, .Net 3.5 using WPF (Windows Forms also okay)
I have a strongly-typed datatable and I search for a row by primary key

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.