I’m having an issue where a modal window pops up in my browser after I return to the View from the controller. The modal window contains the html code from the Index.cshtml page.
Here is the code from my controller:
public ActionResult Save(Events changedEvent,FormCollection actionValues)
{
string action_type = actionValues["!nativeeditor_status"];
var eventText = actionValues["text"];
var eventStart = actionValues["start_date"];
var eventEnd = actionValues["end_date"];
try
{
switch (action_type)
{
case "inserted":
if (User.IsInRole("Admin"))
db.Event.Add(changedEvent);
Send(eventText, eventStart, eventEnd);
break;
case "deleted":
//changedEvent = db.Event.SingleOrDefault(ev => ev.Id == source_id);
changedEvent = db.Event.SingleOrDefault(ev => ev.text == eventText);
db.Event.Remove(changedEvent);
break;
default: // update
//changedEvent = db.Event.SingleOrDefault(ev => ev.Id == source_id);
changedEvent = db.Event.SingleOrDefault(ev => ev.text == eventText);
UpdateModel(changedEvent);
break;
}
db.SaveChanges();
}
catch (Exception)
{
action_type = "error";
}
return RedirectToAction("Index", "Home");
}
And here is my code from my Index.cshtml page that binds to the Save method:
function init() {
var dp = new dataProcessor("/Home/Save");
dp.init(scheduler);
dp.setTransactionMode(“POST”, false);
}
I am I missing something in my Index.cshtml to handle what is returned when the Save function is called? Is there an alert in the scheduler that I have to handle/disable?
Thanks for any help you can provide!