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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:42:08+00:00 2026-05-17T00:42:08+00:00

Example is fake. ASP.NET MVC: I have a view that renders a student info.

  • 0

Example is fake.

ASP.NET MVC: I have a view that renders a student info. Student info consists of First Name, Last Name and (optional) Age (declared as int?).

Student info is rendered something like, if age is not specified I want to show “not specified”:

<span><%= Model.Student.FirstName %></span>
<span><%= Model.Student.LastName %></span>
<span><%= Model.Student.Age.HasValue ? Model.Student.Age.ToString() : "not specified" %></span>

My problem with text above is that it makes view too complicated (too complicated for my web designer to be able to modify it).

Question: Where could I move that decision?

  1. Property Student of model is a business object, and shall not contain details of rendering.
  2. Should I add a method to Model: Model.GetAgeAsText(Student student)? But then I end up with a host of loosely hanging methods on Model, that are crying to be grouped into something…but what?
  3. I could create a custom control StudentAgeShower, this appears to be the most OO-correct solution, but seems to be bit overkill.

Any suggestions?

  • 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-17T00:42:09+00:00Added an answer on May 17, 2026 at 12:42 am

    Create a View Model of a Student with all the decisions premade.

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

Sidebar

Related Questions

I working my way through the Apress Pro ASP.NET MVC Framework ( http://www.apress.com/book/view/9781430210078 )
I have the following (example) of my xml document: <Students> <Student ID = *GUID
Lets imagine my situation (it's fake, of course)... I have web-site that have 1000
I've noticed that jQuery can create, and access non-existent/non-standard HTML tags. For example, $('body').append('<fake></fake>').html('blah');
Sorry if you found that I'm asking stupid questions. But I'm new to asp.net
Using MVC3.NET I have a file upload method in a controller that works fine
I am new to unit testing. I have a web application using asp.net mvc3
For example on any tinyurl/ajdeijad link (this one is fake), the think redirects to
Example: You have a shortcut s to SomeProgram in the current directory. In cmd.exe
Example I have Person , SpecialPerson , and User . Person and SpecialPerson are

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.