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

  • Home
  • SEARCH
  • 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 9230347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:48:13+00:00 2026-06-18T05:48:13+00:00

I started up a Default MVC 4 project using the ASPX engine (not Razor),

  • 0

I started up a Default MVC 4 project using the ASPX engine (not Razor), and everything works fine.
I can use

<% Model.Name %>

and

<% Model.Rating %>

for book ratings (instead of the Restaurant Review that is up on the asp.net/mvc tutorials site). However, my code errors on the
<% ViewBag.Message %>

…so for some reason, when inheriting from the “BookReviewer” Class within the BookReview model, I can view the Model information but not the Viewbag? Am I missing something? Code below.

[Controller]
HomeController.cs:

    public class HomeController : Controller
    {
        var model = new BookReview()
        {
            Name = "Pro jQuery For Noobs",
            Rating = 7
        };
        return View(model);
    }

[Model]
BookReview.cs

    namespace Bookreview.Models
    {
            public class BookReview
            {
                    public string Name { get; set; }
                    public int Rating { get; set; }
            }
    }

[View]
Index.aspx:

    <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<BookRevew.Models.BookReviewer>" %>
    <asp:Content ID="indexFeatured" ContentPlaceHolderID="FeaturedContent" runat="server">
        <h2>
            <% ViewBag.Message %>
            <% Model.Name %>
            <% Model.Rating %>
        </h2>
    </asp:content>
  • 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-18T05:48:14+00:00Added an answer on June 18, 2026 at 5:48 am

    As we can see by your comments, you are setting the ViewBag.Message in another controller. The ViewBag is only for data for the view that was set by the controller that served the view.

    If you need to send it from another controller, you should use a parameter in your action method, then you can set the ViewBag.Message to the passed in parameter.

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

Sidebar

Related Questions

Intro I'm developing a project with MVC.Net. I have just started a default website
I've started work on my first mvc project and also using jquery for the
Just started my first MVC 2.0 .net application. And I set up some default
I started using Emacs (ESS) as a default R editor (yes, @Dirk, as you've
I’ve only just started using ASP.NET MVC, and I have a somewhat trivial question:
I am using T4MVC in my ASP.NET MVC 3 project. I have the following
I am using ASP.NET MVC 4 for the first time, so I started with
I'm looking at a tutorial for asp.net mvc here on the asp site: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-basic-crud-functionality-with-the-entity-framework-in-asp-net-mvc-application
I started with the default ASP.net MVC 3 application and I got the following
I am just getting started using DotNetOpenAuth with an MVC app and I am

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.