我有一个非常基本的表单,我使用模型从视图中渲染。在这种形式中,我有一些这样的文本输入:
<div class="editor-label">
@Html.LabelFor(model => model.UserProfile.FirstName)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.UserProfile.FirstName)
@Html.ValidationMessageFor(model => model.UserProfile.FirstName)
</div>
当它在网页上呈现时,它包含这种讨厌的内联样式:
<input
id="UserProfile_FirstName"
name="UserProfile.FirstName"
type="text"
value="xxx"
sourceindex="4"
style="border-style: solid; border-width: 1px;
border-color: rgb(238, 50, 50) rgb(240, 80, 80) rgb(240, 80, 80);
box-shadow: rgb(250, 230, 230) 1px 1px inset;
-webkit-box-shadow: rgb(250, 230, 230) 1px 1px inset;">
我尝试了几种方法来删除它,包括
@Html.TextBoxFor(model => model.UserProfile.LastName, null,
{ @style = "border-width: 0px;" })
和类似的,但我添加的内联样式是在我要删除的样式之前添加的,因此它们会被覆盖。
如何删除或覆盖此内联样式?