I came back with another question ...
I´m following a post published by Sebastiaan Janssen (https://umbraco.com/follow-us/blog-archive/2013/7/14/moving-from-webforms-to-mvc/) that is opening my mind how how to properly migrate my uses controls V4.
Anyway, this post it passes to the PartialView a parameter to feed the contact form selection list .. I adapted the codes shown for V7, as some command that he includes in the post have been modified by others ..
The original command would look like this:
Html.RenderPartial ( "~ / Views / Partials / Contact.cshtml" new Site_UmbracoF.Models.ComunicarErroModel {TipoComunicado = tipoErro});
where Site_UmbracoF is the VS project name that contains the Umbraco .. Of course the Umbraco rejected the command ...
My structure is:
- Controller: ComunicarErroController.cs
- Model: ComunicarErroModel.cs
- Views: ComunicarErro.cshtml (which in Umbraco is within Template) and ComunicarErroForm.cshtml
How can I pass this parameter to the PartialViews?
Partial Views with parameters
Hi, Folks !!!
I came back with another question ... I´m following a post published by Sebastiaan Janssen (https://umbraco.com/follow-us/blog-archive/2013/7/14/moving-from-webforms-to-mvc/) that is opening my mind how how to properly migrate my uses controls V4.
Anyway, this post it passes to the PartialView a parameter to feed the contact form selection list .. I adapted the codes shown for V7, as some command that he includes in the post have been modified by others ..
The original command would look like this: Html.RenderPartial ( "~ / Views / Partials / Contact.cshtml" new Site_UmbracoF.Models.ComunicarErroModel {TipoComunicado = tipoErro});
where Site_UmbracoF is the VS project name that contains the Umbraco .. Of course the Umbraco rejected the command ...
My structure is: - Controller: ComunicarErroController.cs - Model: ComunicarErroModel.cs - Views: ComunicarErro.cshtml (which in Umbraco is within Template) and ComunicarErroForm.cshtml
How can I pass this parameter to the PartialViews?
Greetings!
Hi,
You could use ViewData:
Then in the partial view
I don't think you need to have the full path to the partial file though, "Contact" may be enough.
Ver.
Hi, Veronica!!
Thanks for you answer, by unfortunately I didn´t understand your solution. Could you explain me?
I follow others tutorial and occurred the same. My Umbraco´s version is 7.4.3.
is working on a reply...