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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:01:27+00:00 2026-06-17T07:01:27+00:00

I have created a simple class which contains three properties ID Name Amount i

  • 0

I have created a simple class which contains three properties

ID
Name
Amount

i have passed the namespace of model to controller class, as

public class _1Controller : Controller
    {
        //
        // GET: /1/
        Customer objCustomer = new Customer();
        public ActionResult Index()
        {
            ViewData["CurrentTime"] = DateTime.Now.ToString();
            return View();
        }

        public ViewResult DisplayCustomer()
        {
            Customer objCustomer = new Customer();
            objCustomer.ID = 12;
            objCustomer.Name = "1001";
            objCustomer.Amount = 90.34;

            return View("DisplayCustomer", objCustomer);
        }

    }

when i have bind the controller class to a view,as

@model MvcApplication4.Models.Customer

@{
    Layout = null;
}

<html>
<head>
    <title>DisplayCustomer</title>
</head>
<body>
    <div>
       The customer id is <%= Model.Id %> <br /> 
       the customer Name is <%= M
    </div>
</body>
</html>

when i am trying to call class properties, it doesn’t show.
i have clicked the strongly typed checkbox while binding the view to a controller.Thanks for any assistance.

  • 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-06-17T07:01:28+00:00Added an answer on June 17, 2026 at 7:01 am

    MVC3 has a number of razor Html helper methods to accomplish this.

    Instead of

    <%= Model.Id %>
    

    try this

    @Html.DisplayFor(model => model.ID)
    

    Here is a list of these helper on MSDN

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

Sidebar

Related Questions

i have created a simple public ref class in the vc++ project, which is
I have created the simple web service. Code: [ServiceContract] public interface ITsdxService { [OperationContract]
I have created this simple program to learn shared_ptr using namespace std; #define Yes
I have created a simple XNA Windows Class Library with XNA 4.0 called NivekGameEngine.
This a data binding question in C#. I have a simple Person class: public
I'm writing an MVC2 app using DataAnnotations. I have a following Model: public class
I have a model that looks something like this: public class SampleModel { public
My situation I have an entity model with a base class ItemBase which defines
With EF CTP5 Code-First I am trying to map a class model which contains
I have created a JPanel which contains an arbitrary number of JLabels, laid out

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.