I have created a controller by name AdmissionControlller there I have added two ActionResult functions: Create and Post Event
// POST: /Admission/Create
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(FormCollection collection)
{
try
{
// TODO: Add insert logic here
return RedirectToAction("Index",collection);
}
catch
{
return View();
}
}
//Return the List of Subject For the Class Selected
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Details(string className)
{
var subject = SubjectsModel.SelectSubjectsByClass(className);
return PartialView("EntranceMarks", subject);
}
now in the view page
Create Page
<h2>
Create</h2>
<% using (Html.BeginForm())
{%>
<%= Html.ValidationSummary(true) %>
<fieldset>
<legend>Fields</legend>
<div class="editor-label">
<%= Html.LabelFor(model => model.Id) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.Id) %>
<%= Html.ValidationMessageFor(model => model.Id) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.PlNo) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.PlNo) %>
<%= Html.ValidationMessageFor(model => model.PlNo) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.AdmissionNo) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.AdmissionNo) %>
<%= Html.ValidationMessageFor(model => model.AdmissionNo) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.AdmissionDate) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.AdmissionDate) %>
<%= Html.ValidationMessageFor(model => model.AdmissionDate) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.FirstName) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.FirstName) %>
<%= Html.ValidationMessageFor(model => model.FirstName) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.MiddleName) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.MiddleName) %>
<%= Html.ValidationMessageFor(model => model.MiddleName) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.LastName) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.LastName) %>
<%= Html.ValidationMessageFor(model => model.LastName) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.Class) %>
</div>
<%using (Ajax.BeginForm("Details", new AjaxOptions {
UpdateTargetId = "EntranceMarks" }))
{ %>
<div class="editor-field">
<%=Html.DropDownList("StudentClass")%>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.Section) %>
</div>
<div class="editor-field">
<%=Html.DropDownList("Section")%>
</div>
<div class="editor-label" id="EntranceMarks">
</div>
<%} %>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
<% } %>
<div>
<%= Html.ActionLink("Back to List", "Index") %>
</div
Now when I change the dropdownlist box for class I am unable to fire the event??