학생을 삽입 한 후 동일한 브라우저에 메시지를 표시하려면 어떻게합니까? 현재 나는 새 페이지에 저를 탐색 반환 컨텐츠를 사용하고,하지만 같은 페이지에서 메시지를 표시하고 같은 페이지에 있고 싶어 :동일한 페이지에 확인 메시지가 표시됩니다.
인덱스 컨트롤러 :
public ActionResult Index()
{
return View(_repository.ListAll().OrderByDescending(s => s.StudentID));
}
컨트롤러 작업 :
사전에public ActionResult RemoveStudent(int id)
{
StudentDataContext student= new StudentDataContext();
var std = student.Students.Single(s => s.StudentID == id);
student.Students.DeleteOnSubmit(std);
student.SubmitChanges();
return Content("Student " + std.StudentId.ToString() + " Removed");
}
감사
죄송 합니다만, 잊어 버렸습니다. 제거 작업이 시작된 인덱스 뷰가 있습니다. 이 페이지에서 RemoveStudent 작업 – user793468
@ user793468을 실행 한 후 메시지를 표시하고 싶다면 RedirectToAction을 호출하고 Action/View를 전달하여 단일 요청에 대해 존재할 TempData에 메시지를 저장할 수 있습니다. – Brandon