<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script>
$(document).ready(function () {
$('#StudentName').change(function () {
$('#Fee').val($(this).val());
alert(Fee);
});
});
</script>
@using (@Html.BeginForm("Edit", "StudentFee", FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
<div class="form-group">
<label class="col-sm-2 control-label">
Agent Name
</label>
<div class="col-md-3">
@Html.DropDownList("StudentName", (IEnumerable<SelectListItem>)@ViewBag.StudentName, "select value")
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">
Fee
</label>
<div class="col-md-3">
@Html.Editor("Fee", new { @class = "form-control" })
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-md-3">
<input type="button" value="New" id="Create"/>
</div>
</div>
</div>
}
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.StudentId)
</th>
<th>
@Html.DisplayNameFor(model => model.Date)
</th>
<th>
@Html.DisplayNameFor(model => model.Fee)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.StudentId)
</td>
<td>
@Html.DisplayFor(modelItem => item.Date)
</td>
<td>
@Html.DisplayFor(modelItem => item.Fee)
</td>
<td>
@Html.ActionLink("Collect", "Edit", new { id = item.Id }) |
@Html.ActionLink("Details", "Details", new { id=item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id=item.Id })
</td>
</tr>
}
</table>