MVC 4 Controller will not show view
I have a controller with a ActionResult I added after the initial build
Named SubAlertModal
[HttpPost]
public ActionResult SubAlertModal(int alertid)
{
var SubAlerts = from sa in db.csSubAlerts
where sa.AlertID == alertid
select sa;
// csAlert cssubalert = db.csAlerts.Find(alertid);
// return View();
return Request.IsAjaxRequest() ? PartialView(SubAlerts) :
PartialView(SubAlerts);
}
on the Index.cshtml page I add an HTML.ActionLink the looks like the folling
@foreach (var item in Model) {
<tr>
<td>
@Html.ActionLink("Sub_Alert", "SubAlertModal", new { id =
item.AlertID }, new {
@class = "ModalOpener" })
</td>
<td>
@Html.DisplayFor(modelItem => item.Routes)
</td>
<td>
@Html.DisplayFor(modelItem => item.Issue)
</td>
<td>
@Html.DisplayFor(modelItem => item.Detour)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateEntered)
</td>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.SendEmail)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.AlertID }, new {
@class="ModalOpener" }) |
@Html.ActionLink("Details", "Details", new {id = item.AlertID }) |
@Html.ActionLink("Delete", "Delete", new { id = item.AlertID})
</td>
</tr>
}
the one inquestion is the first . when i click on the Sub_Alert in the
list it gives me a 404 error. the url is correct. is the controller not
matching up with the view. this is the view i want to load in a modal
window or any window at this point @model IEnumerable
@{
ViewBag.Title = "SubAlerts";
}
<h2>SubAlert</h2>
<div id="SubAlertModal" title="Sub Alert for the Alert">
This is a test modal
and it appears to be working !!
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.Issue)
</th>
<th>
@Html.DisplayNameFor(model => model.Detour)
</th>
<th>
@Html.DisplayNameFor(model => model.DateEntered)
</th>
<th>
@Html.DisplayNameFor(model => model.EnteredBy)
</th>
<th>
@Html.DisplayNameFor(model => model.SendEmail)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Issue)
</td>
<td>
@Html.DisplayFor(modelItem => item.Detour)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateEntered)
</td>
<td>
@Html.DisplayFor(modelItem => item.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.SendEmail)
</td>
</tr>
}
</table>
</div>
Thanks
Joe
No comments:
Post a Comment