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 6605479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:17:20+00:00 2026-05-25T19:17:20+00:00

First of all, I have been a php programmer for a long time and

  • 0

First of all, I have been a php programmer for a long time and I am a mvc programmer newly. I did a few minor web sites that each have one or two controller at most. But I’ve started a website that will be very major web site. There will be a lot of data to pass to views.

Now, normally I try to use model approach every time instead of ViewBag or ViewData approach. If the view demands more data, then I change the model class and then recompile the project. Especially, if the topic is an index page, the data to pass to the index’s view changes every time. In a big web site, I’ll use a lot of partial view that uses different models. So every time, I will have to change the index’s model to support those partial views in the index view. if I add a new partial view into index view, I have to add the partial’s model into the index’s model.

I implement an IndexModel class for an index view every time when I start a website. Then I add properties to this model every time when I add a new partial view to the index.

Now is this a correct approach or should I use ViewBag or ViewData for partials’ models. I think the real question is when we should use the model approach and when we shouldn’t…

If you share your experiences, I would be grateful.

  • 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-25T19:17:20+00:00Added an answer on May 25, 2026 at 7:17 pm

    The MVC approach you should use always, especially for simple sites, it’s save your time and make application more understandable.

    If you write something larger than two pages, you need to use MVVM pattern (growth of MVC), in that case you will escape from using “partial models” with ViewModels.

    Model must contain only busines logic.

    Be better if you will always use ViewModel (not a Model) for returning data from a view and pass it to view, because it provides some safety.

    For facilitate the procedure of copy data from Models to ViewModels use the things like AutoMaper and EmitMapper.

    ViewBag and ViewData you should use only for additional data’s like item colections for DropDown, or some view-text like page title.

    One more advantage of MVVM pattern is better testability. If you write and support really hugh site you may write tests for some responsible parts of code.

    For more details you can look at google – MVVM, ASP-MVC.

    If i something not understad in you question or miss, write it in the comment (“add comment” ref).

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

Sidebar

Related Questions

First of all, let me say I am very new to rails, have been
First of all many thanks for clicking into my question. I have a few
The Disclaimer First of all, I know this question (or close variations) have been
first time poster, but please help. I have been searching and reconfiguring for 6
I work at a small Web Dev firm, and have been handling all the
I only got into PHP a few months ago and have been dabbing into
I have been writing php and mySQL functions all day and as I was
First of all I have to admit that my programming skills are pretty limited
So first of all I have such image (and ofcourse I have all points
To execute my application in iPhone first of all I have to add provisioning

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.