none
Trying to convert Razor to ASPX.

    Question

  • i am doing a simple (I think) tutorial for MVC.  The only issue is the tutorial uses Razor and I need to use ASPX.  Job I'm looking at uses it.

    I have spent hours looking over the internet for possibilities but I am still getting this error:

    Compilation Error

     

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS1061: 'object' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

    Source Error:

    The code is:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using EdeToFood.Models;
     
    namespace EdeToFood.Controllers
    {
        public class HomeController : Controller
        {
            public ActionResult Index()
            {
                ViewBag.Message = "Welcome to ASP.NET MVC!";
     
                var model = new RestaurantReview()
                {
                    Name = "Tersiguil's",
                    Rating = 9
                };
     
                return View(model);
            }
     
            public ActionResult About()
            {
                ViewBag.Location = "Maryland, USA";
                return View();
            }
        }
    }
    
    <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
     
    <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
        Home Page
    </asp:Content>
     
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <h2><%: ViewBag.Message %></h2>
        <p>
            To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
        </p>
        
        <div >
        Restaurant:  <%: Model.Name %>
        Rating:  <%: Model.Rating %>
     
        </div>
    </asp:Content>
    Saturday, February 04, 2012 11:22 PM