在MVC3中使用jquery插件
我使用的是jquery星级插件。以前我只需要一个EditorFor文本框,它会传递用户输入的值,但现在我有5颗星,如何在我的参数中传递星号的值。例如,如果我给一名教师打分为4颗星,那么我怎么能/会将这4颗星与我提交的其他所有东西一起通过呢在MVC3中使用jquery插件,jquery,asp.net-mvc-3,Jquery,Asp.net Mvc 3,我使用的是jquery星级插件。以前我只需要一个EditorFor文本框,它会传递用户输入的值,但现在我有5颗星,如何在我的参数中传递星号的值。例如,如果我给一名教师打分为4颗星,那么我怎么能/会将这4颗星与我提交的其他所有东西一起通过呢 @using (Html.BeginForm()) { @Html.ValidationSummary(true) <fieldset> <legend>Teachers Ratings Wall&
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Teachers Ratings Wall</legend>
<div class="editor-label">
@Html.LabelFor(model => model.StarRating)
</div>
<div class="editor-field">
@*@Html.EditorFor(model => model.StarRating)*@
@Html.ValidationMessageFor(model => model.StarRating)
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
</div>
<div class="editor-label">
@Html.LabelFor(model => model.PostComment)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.PostComment)
@Html.ValidationMessageFor(model => model.PostComment)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.PostDate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.PostDate)
@Html.ValidationMessageFor(model => model.PostDate)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Teacher)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Teacher)
@Html.ValidationMessageFor(model => model.Teacher)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
@使用(Html.BeginForm()){
@Html.ValidationSummary(true)
教师评级墙
@LabelFor(model=>model.starting)
@*@EditorFor(model=>model.starting)*@
@Html.ValidationMessageFor(model=>model.starting)
@LabelFor(model=>model.PostComment)
@EditorFor(model=>model.PostComment)
@Html.ValidationMessageFor(model=>model.PostComment)
@LabelFor(model=>model.PostDate)
@EditorFor(model=>model.PostDate)
@Html.ValidationMessageFor(model=>model.PostDate)
@LabelFor(model=>model.Teacher)
@EditorFor(model=>model.Teacher)
@Html.ValidationMessageFor(model=>model.Teacher)
您应该将这些
移动到编辑器模板中,并将名称设置为@ViewData.TemplateInfo.GetFullHtmlFieldName(“”
),将值设置为1到4
标准MVC模型绑定应该可以处理其余的问题。我对html还是很陌生,我怎么才能制作一个编辑器或模板呢?谢谢你把你想用作编辑器的html标记放进去。