Starting out with MVC4 and Razor forms but having trouble showing a calculated field in the form - prior to submitting the form.
Say, for simplicity sake, we have fields Price and Quantity which are editable textboxes and a third readonly textbox to show the calculated total Price * Quantity.
This post suggests it's nice and easy with our newfangled Razor but when we try the below absolutely nothing changes dynamically on the form:
@{
var value = model.Item.Value;
var price = model.Item.Proce;
var calculated = value * price;
}
<div class="price">Your price: @calculated</div>