I would like to create a editortemplate for a jquery star rating plugin. This is my first mvc3 project and new to jquery and I'm not sure how to set one up. What I want to do is allow the user to rate a teacher by stars. So for example if I click 3 stars how can I pass 3 in with all the rest of the info that is being passed in so that I can save that number in the db. After the partial view is made, how would I then reference it in the actual view where I need it? Thanks for any advice.
@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-label">
@*@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>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
So in the partial view, would I just have:
@model SpeakOut.Model.TeachersRatingsWall
<script src="../../Scripts/jquery.rating.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.rating.pack.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.MetaData.js" type="text/javascript"></script>
<link href="../../Content/jquery.rating.css" rel="Stylesheet" type="text/css" />
<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" />