TextBoxFor calls my function but doesn't change my decimal display value (2.645844).
EditorFor sets my value to 1 decimal place (2.6), but doesn't call my function.
I have the following attribute in my model:
[DisplayFormat(DataFormatString = "{0:N1}", ApplyFormatInEditMode = true)]
public decimal AttritionRate { get; set; }
On a change event I need to run a recalculate function:
@for (int i = 0; i < Model.Positions.Count(); i++)
{
@Html.TextBoxFor(p => p.Positions[i].AttritionRate, new { type = "number", onkeyup = "updateBigTotal(" + i + "," + Model.Positions[i].AttritionRate + ")" })
}
Where I then call the follwoing in javascript:
function updateBigTotal(arraypos, oldValue) {
var newvalue = parseFloat($('#Positions_' + arraypos + '__AttritionRate').val());
... go on to perform calculations
}
How do I achieve both?