Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
This is becasue it is a ViewCompoent and they do not respond to post. If you want to post something use a regular controller.
Hi everyone,
I am facing the problem of how to call a controller's action methot correctly (with POST data) from a MVC form. Data are always null. From the httpcontext I can see that the form contains data, but it is trying to bind the dato to wrong model - it is trying to find model with properties like "CurrentPage.MainContentArea.FooProperty".
In order to be able somehow fetched the data I had to use attribute [BindProperty(Name = "CurrentPage.MainContentArea.FooProperty")]
I tried to inspire by the foundation project in git repo https://github.com/episerver/Foundation but to my surprise the similar logic is not working even there! (testing on GroupCreationBlockComponent). To make that block even render I had to change the path to it's view. Then I also created a new controller for the submit action method but the model binding is not working here too.
What I need is: Create block which will render an MVC form and send those data to Action method
I guess I don't need to share the source code, the foundation project is a good example.