partial views from a mvc project only display macroalias and name
Hi all, I have created MVC project and created a Contact us form in that and set the controller inherits from SurfaceController and create model and view.
in my view BeginUmbracoForm is underline in red and hover over it says HtmlHelper
but when I rebuild project I don't get any errors. How do I solve this issue please.
I have copied the cshtm file in to Views/Macropartials folder and copied dll of my project to bin folder then created a Macro in umbraco (7.5.3) and added macro to a page from RichTextEditor. I cannot see my form in web page it only shows Macroalias:Contactform
I have below in my view I cannot add both inherits and model in view it give me error. After adding Umbraco.Web BeginUmbracoForm problem solved but still form not display on page. log file say Exception: System.InvalidOperationException: The model item passed into the dictionary is of type 'Umbraco.Web.Models.PartialViewMacroModel', but this dictionary requires a model item of type 'iccoukumbracoMVC.Models.ContactFormViewModel'.
still get error Error loading Partial View (file: ~/Views/MacroPartials/ContactForm.cshtml). Exception: System.InvalidOperationException: The model item passed into the dictionary is of type 'Umbraco.Web.Models.PartialViewMacroModel', but this dictionary requires a model item of type 'iccoukumbracoMVC.Models.ContactFormViewModel'.
I have copied my dll file into bin folder of website hope that is correct ?
partial views from a mvc project only display macroalias and name
Hi all, I have created MVC project and created a Contact us form in that and set the controller inherits from SurfaceController and create model and view.
in my view BeginUmbracoForm is underline in red and hover over it says HtmlHelper
but when I rebuild project I don't get any errors. How do I solve this issue please.
I have copied the cshtm file in to Views/Macropartials folder and copied dll of my project to bin folder then created a Macro in umbraco (7.5.3) and added macro to a page from RichTextEditor. I cannot see my form in web page it only shows Macroalias:Contactform
any body know how to do this please.
Hi Pat,
Can you show what do you inherit in your view? Show please top part of view.
THanks,
Alex
I have below in my view I cannot add both inherits and model in view it give me error. After adding Umbraco.Web BeginUmbracoForm problem solved but still form not display on page. log file say Exception: System.InvalidOperationException: The model item passed into the dictionary is of type 'Umbraco.Web.Models.PartialViewMacroModel', but this dictionary requires a model item of type 'iccoukumbracoMVC.Models.ContactFormViewModel'.
`@using Umbraco.Web @@inherits Umbraco.Web.Mvc.UmbracoViewPage@ @model ContactFormViewModel
@{ Html.EnableClientValidation(true); Html.EnableUnobtrusiveJavaScript(true); }
@if (Convert.ToBoolean(TempData["IsSuccessful"])) {
} else { using (Html.BeginUmbracoForm
}`
Hi Pat,
Try to remove
Leave like that:
Thanks,
Alex
Hi Alex,
still get error Error loading Partial View (file: ~/Views/MacroPartials/ContactForm.cshtml). Exception: System.InvalidOperationException: The model item passed into the dictionary is of type 'Umbraco.Web.Models.PartialViewMacroModel', but this dictionary requires a model item of type 'iccoukumbracoMVC.Models.ContactFormViewModel'.
I have copied my dll file into bin folder of website hope that is correct ?
I refereed this article https://creativewebspecialist.co.uk/2013/07/22/umbraco-mvc-what-on-earth-is-a-surface-controller/
Hi Pat,
Can you show how did you call you partial?
Maybe you just pass wrong model?
THanks,
Alex
Hi thanks for helping
and in my controller.cs file
is working on a reply...