ASP.NET MVC和@Html.RowFor(x=>;x.Name)如何添加CSS

ASP.NET MVC和@Html.RowFor(x=>;x.Name)如何添加CSS,html,css,asp.net-mvc,Html,Css,Asp.net Mvc,现在我有了如下代码: @Html.RowFor(x => x.Name) 但我想将其转换为我的模板,如: <div class="control-group"> <label class="control-label" for="focusedInput">Name</label> <div class="controls"> <input class="input-xlarge focused" id="Name" type="te

现在我有了如下代码:

@Html.RowFor(x => x.Name)
但我想将其转换为我的模板,如:

<div class="control-group">
<label class="control-label" for="focusedInput">Name</label>
<div class="controls">
<input class="input-xlarge focused" id="Name" type="text" value="Name">
</div>
</div>

名称

如何添加所有类?

添加类可以这样做:

@Html.RowFor(x => x.Name, new { @class="control-group other-class" })

可以这样添加类:

@Html.RowFor(x => x.Name, new { @class="control-group other-class" })

可以这样添加类:

@Html.RowFor(x => x.Name, new { @class="control-group other-class" })

可以这样添加类:

@Html.RowFor(x => x.Name, new { @class="control-group other-class" })

使用razor语法时,可以添加如下html属性:

@HtmlSomeControl(x=> x.Whatever, new { id="idNameOfControl", @class="classNameOfControl" })
因此,您的代码基本上会变成:

@Html.LabelFor(x => x.Name, new { @class="control-group control-label" )
@Html.DropDownListRowFor(x => x.SelectedCountryId, Model.Country.ViewModel.Countries, new { @class="controls input-xlarge focused")

希望这有帮助

使用razor语法时,可以添加如下html属性:

@HtmlSomeControl(x=> x.Whatever, new { id="idNameOfControl", @class="classNameOfControl" })
<div class="control-group">
@HtmlLabelFor(x => x.Name, new { @class="control-label" })
<div class="controls">
 @HtmlTextBoxFor(x => x.Name, new {@class="input-xlarge focused", @id="Name" })
</div>
</div>
因此,您的代码基本上会变成:

@Html.LabelFor(x => x.Name, new { @class="control-group control-label" )
@Html.DropDownListRowFor(x => x.SelectedCountryId, Model.Country.ViewModel.Countries, new { @class="controls input-xlarge focused")

希望这有帮助

使用razor语法时,可以添加如下html属性:

@HtmlSomeControl(x=> x.Whatever, new { id="idNameOfControl", @class="classNameOfControl" })
<div class="control-group">
@HtmlLabelFor(x => x.Name, new { @class="control-label" })
<div class="controls">
 @HtmlTextBoxFor(x => x.Name, new {@class="input-xlarge focused", @id="Name" })
</div>
</div>
因此,您的代码基本上会变成:

@Html.LabelFor(x => x.Name, new { @class="control-group control-label" )
@Html.DropDownListRowFor(x => x.SelectedCountryId, Model.Country.ViewModel.Countries, new { @class="controls input-xlarge focused")

希望这有帮助

使用razor语法时,可以添加如下html属性:

@HtmlSomeControl(x=> x.Whatever, new { id="idNameOfControl", @class="classNameOfControl" })
<div class="control-group">
@HtmlLabelFor(x => x.Name, new { @class="control-label" })
<div class="controls">
 @HtmlTextBoxFor(x => x.Name, new {@class="input-xlarge focused", @id="Name" })
</div>
</div>
因此,您的代码基本上会变成:

@Html.LabelFor(x => x.Name, new { @class="control-group control-label" )
@Html.DropDownListRowFor(x => x.SelectedCountryId, Model.Country.ViewModel.Countries, new { @class="controls input-xlarge focused")
希望这有帮助


<div class="control-group">
@HtmlLabelFor(x => x.Name, new { @class="control-label" })
<div class="controls">
 @HtmlTextBoxFor(x => x.Name, new {@class="input-xlarge focused", @id="Name" })
</div>
</div>
@HtmlLabelFor(x=>x.Name,新的{@class=“control label”}) @HtmlTextBoxFor(x=>x.Name,新的{@class=“input xlarge focused”,@id=“Name”})

@HtmlLabelFor(x=>x.Name,新的{@class=“control label”})
@HtmlTextBoxFor(x=>x.Name,新的{@class=“input xlarge focused”,@id=“Name”})

@HtmlLabelFor(x=>x.Name,新的{@class=“control label”})
@HtmlTextBoxFor(x=>x.Name,新的{@class=“input xlarge focused”,@id=“Name”})

@HtmlLabelFor(x=>x.Name,新的{@class=“control label”})
@HtmlTextBoxFor(x=>x.Name,新的{@class=“input xlarge focused”,@id=“Name”})


Thx但我收到编译器错误消息:CS1501:方法“RowFor”没有重载,需要2个参数。我不确定@Html.RowFor控件是否存在(谷歌搜索也不显示)。所有razor元素都有用于指定html属性的扩展方法。无论如何,我已经更新了我的答案,考虑到您只想显示一个用于显示“Name”属性的标签。Thx但我收到编译器错误消息:CS1501:方法“RowFor”没有重载2个参数我不确定是否存在@html.RowFor控件(谷歌搜索也不显示)。所有razor元素都有用于指定html属性的扩展方法。无论如何,我已经更新了我的答案,因为您只想显示一个用于显示“名称”的标签Thx,但我收到编译器错误消息:CS1501:方法“RowFor”没有重载需要2个参数我不确定@Html.RowFor控件是否存在(google搜索也不显示)。所有razor元素都有用于指定html属性的扩展方法。无论如何,我已经更新了我的答案,因为您只想显示一个用于显示“Name”属性的标签。Thx但我收到编译器错误消息:CS1501:方法“RowFor”没有重载2个参数我不确定是否存在@html.RowFor控件(谷歌搜索也不显示)。所有razor元素都有用于指定html属性的扩展方法。无论如何,我已经更新了我的答案,因为您只想显示一个用于显示“Name”属性的标签。其中是
html.RowFor()
来自?@mxfluist,没错,我一开始是怎么想的?但后来,我想这可能是一个我从未听说过的控件。但在谷歌上,我找不到任何东西,这表明我根本没有这样的东西!!
Html.RowFor()在哪里
来自?@mxfluist,没错,我一开始是怎么想的?但后来,我想这可能是一个我从未听说过的控件。但在谷歌上,我找不到任何东西,这表明我根本没有这样的东西!!
Html.RowFor()在哪里
来自?@mxfluist,没错,我一开始是怎么想的?但后来,我想这可能是一个我从未听说过的控件。但在谷歌上,我找不到任何东西,这表明我根本没有这样的东西!!
Html.RowFor()在哪里
来自?@mxfluist,没错,我一开始是怎么想的?但后来,我想这可能是一个我从未听说过的控件。但在谷歌上,我找不到任何东西,这表明我没有这样的东西!!否决票?没有@Html.RowFor…在divs中有一个标签和一个文本框。否决票?没有@Html.RowFor…有一个标签在divs中有一个文本框。向下投票?没有@Html.RowFor…在divs中有一个标签和一个文本框。向下投票?没有@Html.RowFor…在divs中有一个标签和一个文本框。