Removing certain characters from model input in Html.EditorFor (Razor / ASP.NET)

457 views Asked by At

model.Question2AResponse and model.Question2AResponse are two fields that are of type decimal. I want it to be so the user can enter commas into the Html.EditorFor boxes and have them display, but the model not actually take the value of the comma. So display the comma the user types in, but not actually save the value to the model. Is that possible?

@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
    <fieldset>
        <legend>Questions</legend>
        <div id="content">
            @Html.DisplayFor(model => model.Question2A.QuestionText)
            <br />
            @Html.EditorFor(model => model.Question2AResponse)
            <br />
            @Html.DisplayFor(model => model.Question2B.QuestionText)
            <br />
            @Html.EditorFor(model => model.Question2BResponse)
        </div>
        <div id="buttons">
            <br />
            <input type="submit" name="Command" value="Previous" />
            <input type="submit" name="Command" value="Next" />
        </div>

    </fieldset>
}
0

There are 0 answers