현재 고객 참고 사항을 편집하기 위해 POST에 대해 다음 코드가 있습니다. 검증이 실패하면ASP.NET MVC :보기를 반환 할 때 서버 유효성 검사 및 URL 매개 변수 유지
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EditNote(Note note)
{
if (ValidateNote(note))
{
_customerRepository.Save(note);
return RedirectToAction("Notes", "Customers", new { id = note.CustomerID.ToString() });
}
else
{
var _customer = _customerRepository.GetCustomer(new Customer() { CustomerID = Convert.ToInt32(note.CustomerID) });
var _notePriorities = _customerRepository.GetNotePriorities(new Paging(), new NotePriority() { NotePriorityActive = true });
IEnumerable<SelectListItem> _selectNotePriorities = from c in _notePriorities
select new SelectListItem
{
Text = c.NotePriorityName,
Value = c.NotePriorityID.ToString()
};
var viewState = new GenericViewState
{
Customer = _customer,
SelectNotePriorities = _selectNotePriorities
};
return View(viewState);
}
}
, 나는 그것이 다시위한 editNote보기를 렌더링하지만,이 같은 뭔가를 URL 매개 변수 (NoteID와의 CustomerID)을 유지하려면 :이 작업을 수행하는 방법에 대한 "http://localhost:63137/Customers/EditNote/?NoteID=7&CustomerID=28"
어떤 아이디어?
감사합니다.
네가 맞아. 내 뇌의 방귀. 나에게 필요한 불꽃을 주셔서 감사합니다. 이제 양식을 통해오고있어 작동 중입니다. 감사! – Mike
우수. 기꺼이 도와주세요. –