SurfaceController: Return partial view for rendered partial only (Umbraco 4.11)
Hi all,
I have a question about SurfaceControllers and returning PartialViews from them.
Example:
I have a contact page on my website that has 2 columns (one for the contact information, and one for a contact form). The contact information part is rendered inside the View (Normal Contact.cshtml, is an Umbraco template chosen on the document). The contact form is being rendered inside a partial view (and post to a SurfaceController).
Inside the ContactForm partial is an @Html.BeginUmbracoForm that points to my ContactSurfaceController. All work fine and the post reaches the controller (which sends out my contact form).
After the contact form has been sent I want to show the user what has happened (in case of error, I want to show some red text). I'm searching for a way to return a PartialView from the SurfaceController (possibly with a custom view model, otherwise with the current Umbraco page) that is only rendered inside the original PartialView ContactForm. That way, I don't have to recreate (in a different view) the entire contact page just to show a status message.
SurfaceController: Return partial view for rendered partial only (Umbraco 4.11)
Hi all,
I have a question about SurfaceControllers and returning PartialViews from them.
Example:
I have a contact page on my website that has 2 columns (one for the contact information, and one for a contact form). The contact information part is rendered inside the View (Normal Contact.cshtml, is an Umbraco template chosen on the document). The contact form is being rendered inside a partial view (and post to a SurfaceController).
HTML pseudo code:
Inside the ContactForm partial is an @Html.BeginUmbracoForm that points to my ContactSurfaceController. All work fine and the post reaches the controller (which sends out my contact form).
After the contact form has been sent I want to show the user what has happened (in case of error, I want to show some red text). I'm searching for a way to return a PartialView from the SurfaceController (possibly with a custom view model, otherwise with the current Umbraco page) that is only rendered inside the original PartialView ContactForm. That way, I don't have to recreate (in a different view) the entire contact page just to show a status message.
My guess was to return from the controller:
But that just returned some raw HTML that was printed to my browser.
It could be that I'm doing something wrong here, but it would really be awesome if something like this were possible.
Anyone has any views/anwsers on this? :)
I tried the same. Ended up just doing an ajax js call to the controller.
Here's something interesting... Your controllers can be hit by going to /umbraco/surface/MyclassSurface/
is working on a reply...