mercredi 21 septembre 2016

ASP.NET MVC 3: Remove “name” attribute in TextBoxFor

Is it possible to remove the name attribute generated by Html.TextBoxFor?

The following

@Html.TextBoxFor(x => x.SomeName, new
{
    @class = "some-class",
    @autocomplete = "off",
})

outputs

<input autocomplete="off" class="some-class" id="SomeName" name="SomeName" type="text" value="some value">

I want to be able to generate this HTML though:

<input autocomplete="off" class="some-class" id="SomeName" type="text" value="some value">

Aucun commentaire:

Enregistrer un commentaire