svaznovtex
New Member
I started up a Default MVC 4 project using the \[code\]ASPX\[/code\] engine (not Razor), and everything works fine.
I can use \[code\]<% Model.Name %>\[/code\] and \[code\]<% Model.Rating %>\[/code\] for book ratings (instead of the Restaurant Review that is up on the asp.net/mvc tutorials site). However, my code errors on the \[code\]<% ViewBag.Message %>\[/code\]...so for some reason, when inheriting from the "BookReviewer" Class within the BookReview model, I can view the Model information but not the \[code\]Viewbag\[/code\]? Am I missing something? Code below.[Controller]HomeController.cs:\[code\] public class HomeController : Controller { var model = new BookReview() { Name = "Pro jQuery For Noobs", Rating = 7 }; return View(model); }\[/code\][Model]BookReview.cs\[code\] namespace Bookreview.Models { public class BookReview { public string Name { get; set; } public int Rating { get; set; } } }\[/code\][View]Index.aspx:\[code\] <%@ 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>\[/code\]
I can use \[code\]<% Model.Name %>\[/code\] and \[code\]<% Model.Rating %>\[/code\] for book ratings (instead of the Restaurant Review that is up on the asp.net/mvc tutorials site). However, my code errors on the \[code\]<% ViewBag.Message %>\[/code\]...so for some reason, when inheriting from the "BookReviewer" Class within the BookReview model, I can view the Model information but not the \[code\]Viewbag\[/code\]? Am I missing something? Code below.[Controller]HomeController.cs:\[code\] public class HomeController : Controller { var model = new BookReview() { Name = "Pro jQuery For Noobs", Rating = 7 }; return View(model); }\[/code\][Model]BookReview.cs\[code\] namespace Bookreview.Models { public class BookReview { public string Name { get; set; } public int Rating { get; set; } } }\[/code\][View]Index.aspx:\[code\] <%@ 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>\[/code\]