How to create links in typical CRUD scenario to jump from the index page to the Detail page in same SurfaceController
Please can someone help me out? I am new to Umbraco.
I am moving a crud scenario from MVC 4 to Umbraco. I created a SurfaceController that returns a partial named "AnimalIndex". In the template is de code:
@{ Html.RenderAction("Index", "Animal");}
That is working fine, the final page is decorated with top and bottom templates. However now we need to wire up these buttons:
@Html.ActionLink("Details", "Details", new { id = item.ID })
@Html.ActionLink("Edit", "Edit", new { id = item.ID })
@Html.ActionLink("Delete", "Delete", new { id = item.ID })
...and pointed the link to another called Details with the "For-Sale-With-Members/Details" link. This is an awfull solution. Each time the page is renamed the links are broken.
The results of these links are pages that has bypassed by the Umbraco render engine and the link generates this error:
Server Error in '/' Application.
The "RenderBody" method has not been called for layout page "~/Views/Animal.cshtml".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The "RenderBody" method has not been called for layout page "~/Views/Animal.cshtml".
You can do this behavior entirely client side with angular.
Tim Geyssens wrote a blog about this : http://www.nibble.be/?p=224
This is Umbraco 6 but the same idea applies to Umbraco 7. Mind that you can run in to browser support with this if you need to support older browsers.
How to create links in typical CRUD scenario to jump from the index page to the Detail page in same SurfaceController
Please can someone help me out? I am new to Umbraco.
I am moving a crud scenario from MVC 4 to Umbraco. I created a SurfaceController that returns a partial named "AnimalIndex". In the template is de code:
That is working fine, the final page is decorated with top and bottom templates. However now we need to wire up these buttons:
I tried this one for Details:
...and pointed the link to another called Details with the "For-Sale-With-Members/Details" link. This is an awfull solution. Each time the page is renamed the links are broken.
The results of these links are pages that has bypassed by the Umbraco render engine and the link generates this error:
Hi Willem,
You can do this behavior entirely client side with angular.
Tim Geyssens wrote a blog about this : http://www.nibble.be/?p=224 This is Umbraco 6 but the same idea applies to Umbraco 7. Mind that you can run in to browser support with this if you need to support older browsers.
Another option is to use Virtual nodes.
Here are some blog posts explaining the concept. http://shazwazza.com/post/Custom-MVC-routes-within-the-Umbraco-pipeline http://jamessouth.me/archive/fun-with-umbracovirtualnoderoutehandler/
I don't know if your data comes from Umbraco of a custom db. But let me know what you decide. Maybe I can help you out
Dave
Hi Dave,
Data is coming from the SQL animal table. I expect some thousands or records.
How do i implement this line from default MVC to an Umbraco friendly statement:
The command here above is in the partial AnimalIndex.
The partial is activated through a call to the AnimalSurfaceController with the next command:
Back to the statement:
How does the id parameter from the AnimalIndex partial eaches the partial AnimalDetails?
I need someting like this:
But then the controller result need to be a whole view or Umbraco has to know what template is needed to render the partial...
By the way, i suppose the MapUmbracoRoute from the example need to be made yourself because i cant find it.
Surface controllers have their own routing , so what your are trying to achieve is not possible. https://our.umbraco.org/documentation/Reference/Routing/surface-controllers
It think you need virtual nodes like I mentioned in my previous answer.
is working on a reply...