I have gone through previous posts on the same topic but I couldn't figure out what's wrong with my code. Here's my html
@model Models.Submissions
@{
ViewBag.Title = "Application";
}
<h2 class="Centre" >@ViewBag.Title</h2>
@using (Html.BeginForm("Create","Submissions",FormMethod.Post))
{
@Html.ValidationSummary(true)
<fieldset>
<table id="ApplicationTable">
<tr>
<td>
@Html.LabelFor(model => model.SubmissionId)
</td>
<td>
@Html.TextBoxFor(model => model.SubmissionId)
</td>
</tr>
<tr>
<td>
@Html.LabelFor(model => model.SubmissionDate)
</td>
<td>
@Html.TextBoxFor(model => model.SubmissionId)
</td>
</tr>
</table>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
Here's my controller. The button click doesn't trigger the http post method of the submissions controller . By the way, my controller is "SubmissionsController"
public ActionResult Create()
{
return View();
}
[HttpPost]
public ActionResult Create(Submissions submission)
{
try
{
// TODO: Add insert logic here
// my logic
return RedirectToAction("Index");
}
catch
{
return View();
}
}
}
Thanks..! Help Appreciated
SubmissionDatein your second textbox. Can you show the view model?@Html.ValidationSummary(true)means to display only errors not directly associated with a property (which means you also need to include@Html.ValidationMessageFor()for each property), otherwise use@Html.ValidationSummary(false)