using System;
using System.ComponentModel.DataAnnotations;
namespace HelloWorldMvcApp
{
public class SampleViewModel
}
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
AVG Cost: £@Html.TextBox("AverageCost", "",new { onkeyup = "neg(this)", id = "avgc", style = "width: 50px;"})
<script>
function neg(fld){
fld.style.color = (parseFloat(fld.value) < 0) ? 'white' : 'black';
fld.style.backgroundColor = (parseFloat(fld.value) < 0) ? 'red' : 'white';
</script>
</body>
</html>
using System.Web.Mvc;
using System.Collections.Generic;
public class HomeController : Controller
public ActionResult Index()
return View();