1

我有一个非常基本的表单,我使用模型从视图中渲染。在这种形式中,我有一些这样的文本输入:

<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;" })

和类似的,但我添加的内联样式是在我要删除的样式之前添加的,因此它们会被覆盖。

如何删除或覆盖此内联样式?

4

1 回答 1

1

我不认为这是 TextBoxFor 助手的默认行为。你有在页面上运行的任何 jQuery 插件吗?特别是可能会注入像这样的内联样式的那个?

于 2013-02-06T20:01:07.243 回答