Hi everyone, if I return the view without my model I receive a new error;
Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.
Not in the way you are trying to link to it I don't believe.
What you would need to do is link to you "edit" page (assuming it is a page in Umbraco) and then within that page call the action to render the partial view rather than link to an action that returns a partial view.
This would, I believe, be similar to the required behaviour in a default .Net MVC application.
Then on the edit page you have something like the following
var targetEditId = Request.Params["ref"];
@Html.Action("RenderEditRecord", "Record", new {RecordId = targetEditId})
This would mean that your RenderEditRecord action doesn't need to be passed an ApplicationViewModel any more it be passed only the record id.
It should then render your partial view into your edit page .
You could also put logic in the edit page that if someone was to browse to it without passing in a record ID it could display a generic message instead of trying to render the form.
SOS - Return partial view renders without master page layout!!!
Hi everyone, I’m trying to return a partial view with its master template, but the partial view is being rendered with no master template.
I have a page with a link, if the user clicks on the link, the link will fire the method within the controller
Controller
Template
@{ Layout = "WebBase.cshtml"; }
@{ Html.RenderAction("RenderEditRecord", " Record");} @CurrentPage.GetGridHtml("contentGrid", "bootstrap3")
The partial view renders without the master page layout, any pointers much appreciated, pulling my hair out!!!
Hi Tom
Use just view, not PartialView, use View();
Thanks,
Alex
Hi Alex, my PartialView inherits from @inherits UmbracoViewPage
And my template inherits from @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
I receive the following error when i try to return a view()
Cannot bind source type Models.ApplicationViewModel to model type Umbraco.Web.Models.RenderModel.
How can I return my viewmodel?
Hi everyone, if I return the view without my model I receive a new error;
Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.
Hi Tom,
A couple of questions for you,
1) The "Edit" view, are you expecting that to be a whole page or are you expecting it to be a partial view that is rendered within a page?
2) I'm assuming the Edit view is a form of some description that are you posting back once completed is that correct?
Nik
Hi Nik, regarding the Edit view, I have a whole page, I was hoping to display the partial view inside the whole page.
Is it possible to display a partial view with a master template?
Tom
Hi Tom,
Not in the way you are trying to link to it I don't believe.
What you would need to do is link to you "edit" page (assuming it is a page in Umbraco) and then within that page call the action to render the partial view rather than link to an action that returns a partial view.
This would, I believe, be similar to the required behaviour in a default .Net MVC application.
It could be worth having a read of the following, which might help you achieve what you are after :-) https://our.umbraco.com/Documentation/Reference/Templating/Mvc/forms
Thanks
Nik
Hi Nik, yes the page is an Umbraco page, do mean something like this,
Then the page will call the action to render the partial view, is this what you mean?
Kind of.
What I would expect is something along the lines of you having a generic "Edit" page set up in Umbraco that is on the url (for example)
/edit
Then in the page where you are trying to put the "edit" link you have something like:
Then on the edit page you have something like the following
This would mean that your RenderEditRecord action doesn't need to be passed an ApplicationViewModel any more it be passed only the record id.
It should then render your partial view into your edit page .
You could also put logic in the edit page that if someone was to browse to it without passing in a record ID it could display a generic message instead of trying to render the form.
Does that make sense?
Nik
Thanks worked a treat :)
No worries :-) Happy to have helped.
is working on a reply...