asp.net mvc - RenderAction problems
-
01-10-2019 - |
Question
I'm not quite sure I understand what Html.RenderAction()
does. I've just noticed one weird behavior when using it:
In View/Contacts/Edit.aspx
I used Html.RenderAction("ModalAddNote")
which contains form for adding Notes for Contact. This is for ajax usage (it is opened in modal dialog).
Problem occurs when I create method ModalAddNote
: now, when I submit page for editing Contact I am being redirected to Contacts/ModalAddNote
and not to Contacts/Edit
. If I delete Html.RenderAction("ModalAddNote")
then it works fine. Why is that so and how to control it?
Solution
I found where the problem was... I had two ModalAddNote
methods - one without and one with HttpPost
, so when the page was submitted, Html.RenderAction("ModalAddNote")
would call the one with HttpPost
attribute