then i have added macro in to a RTE ina page , but I cannot see any sites listing on the page it says No Sites.
that mean controller Index method not reached at all isn't it ?
Alex ,
If I add RenderPartial option in macro I get empty page , mean not reaching Inddex method in conroller...
If I add HTMl.action @{Html.Action("Index", "ListSites",new SiteModel());} in to macro i get below error
Server Error in '/' Application.
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/ListSites/Index.aspx
~/Views/ListSites/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/ListSites/Index.cshtml
~/Views/ListSites/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
If I put the page in template it works fine
do i need to update any settings in umbraco /web config .... help would be highly appreciated
Hi Alex thanks for helping but unfortunately that didn't work either , I have changed Html.Action to custom path
A public action method '~/Views/Partials/ListSites/Index.cshtml' was not found on controller 'myicCodeProject.Controllers.ListSitesController'.
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.
I have a huge portal written in webforms layout trying to convert it to MVC.....
Exception Details: System.Web.HttpException: A public action method '~/Views/Partials/ListSites/Index.cshtml' was not found on controller 'myicCodeProject.Controllers.ListSitesController'.
how to add custom mvc form using surface controller and Partial view macro
Hi all, Please could anyone explain me how to create a view and surfacecontroller and then add to a page using partial view macro file.
I have created surface controller code as below
created model call SiteModel and build the project copy dll file in umbraco web site bin folder.
Then I have created view Index.cshtml in folder ListSites and placed it in Views/Partails/ folder in umbraco web site
this is the code on view
then created partial macro file and call Render Partial method
then i have added macro in to a RTE ina page , but I cannot see any sites listing on the page it says No Sites. that mean controller Index method not reached at all isn't it ?
How to fix this please ?
Hi Pat
You have to use rendering ASP.Net MVC ChildAction of your controller, try this code:
Read please great documentation here:
https://our.umbraco.org/documentation/reference/templating/mvc/forms/tutorial-child-action
Thanks,
Alex
Hi Alex , that load the page no errors now but not listing any thing either ..
Hi Pat
Try to use full path to your view in controller:
Thanks,
Alex
No luck still shows blank page... i have just pass int to see it not loading any thing
Pat, if you are going to debug solution? do you see what controller does?
how to debug solution ? Don't I need to debug web page on load ?
you are right, debug solution on page load
I'm trying to understand where is the problem, is controller debugging?
Alex , If I add RenderPartial option in macro I get empty page , mean not reaching Inddex method in conroller...
If I add HTMl.action @{Html.Action("Index", "ListSites",new SiteModel());} in to macro i get below error
Server Error in '/' Application.
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/ListSites/Index.aspx ~/Views/ListSites/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx ~/Views/ListSites/Index.cshtml ~/Views/ListSites/Index.vbhtml ~/Views/Shared/Index.cshtml ~/Views/Shared/Index.vbhtml
If I put the page in template it works fine
do i need to update any settings in umbraco /web config .... help would be highly appreciated
this is what i can see
Pat, you have to use custom path to the view -
View("~/Views/Partials/listSites/Index.cshtml");
Because your view is in an unusual place.
You can easily extend the WebFormViewEngine to specify all the locations you want to look in:
http://stackoverflow.com/a/909594/2123476
Thanks,
Alex
Hi Alex thanks for helping but unfortunately that didn't work either , I have changed Html.Action to custom path
A public action method '~/Views/Partials/ListSites/Index.cshtml' was not found on controller 'myicCodeProject.Controllers.ListSitesController'.
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.
I have a huge portal written in webforms layout trying to convert it to MVC.....
Exception Details: System.Web.HttpException: A public action method '~/Views/Partials/ListSites/Index.cshtml' was not found on controller 'myicCodeProject.Controllers.ListSitesController'.
is working on a reply...