Reputation: 145
I m on a mac and I m working on Dreamweaver. I have this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcMovie.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Modify what?!?!?!.";
return View();
}
}
}
and this view:
@{
ViewBag.Title = "Home Page";
}
@section featured {
<h1>@ViewBag.Title.</h1>
<h2>@ViewBag.Message</h2>
}
Whenever I make a change on the controller's ViewBag.Message
variable, the change doesn't affect the result.
Am I doing something wrong? Of course I don't compile anything, I just change the value of the variable.
Any ideas?
Upvotes: 0
Views: 453
Reputation: 56688
Of course I don't compile anything
That's the problem. Controller is a C# code file in the project, the project should be built for the changes to take place (unlike views, which are compiled on runtime).
Update. The reason this is different from PHP frameworks is that C# is a compiled language - it should be processed by the compiler into library/executable which is then executed. On the other hand PHP scripts are being run (mostly) directly, without any compilation.
Upvotes: 4