css - Removing a html attribute added from razor or keep it from adding -
i'm adding input field via razor
@html.textboxfor(x => x.ccversandkosten, new { @class = "form-control" }) but adds html attributes don't want:
<input class="form-control" data-val="true" data-val-number="das feld"versandkosten" muss eine zahl sein." data-val-required="das feld "versandkosten" ist erforderlich." id="ccversandkosten" name="ccversandkosten" type="text" value="0" /> the attribute don't need value="0". thinks razor adds value attribute because variable ccversandkosten float, alter needs float.
is there way remove attribute or maintain razor adding ?
in model define float. "float" must not null. when model initialize, not-nullable variables initialize 0. not razor feature, c# feature.
so razor display field 0. can define variable nullable (float? ccversandkosten) display nil value attr.
@model mymodel means var model = new mymodel();, when create new class, c# initialize not-nullable variables. (float, int, double, datetime,..)
html css asp.net-mvc razor
No comments:
Post a Comment