Is it possible to pass in a value from Html.Partial?
I have a simple MVC view where i would like to display or pass in a value from a template to the control and take the appropriate action. Here is the template
@inherits Umbraco.Web.Mvc.UmbracoViewPage
@{
Layout = "master.cshtml";
}
@* the fun starts here *@
@Html.Partial("~/Views/Partials/BusinessVenture/Index.cshtml", new BusinessVenture())
The page runs and displays as required.
There are 2 types Business ventures, Fun Activity or Placements.
I have a public property in my code behind
public string BusinessVentName {get; set;};
How can i pass the value from the template to the backend code, so if i set it to FunActivity in the template it would take the appropriate action?
I tried adding a parameter to the controller as below but everything i tried resulted in some syntax error.
@Html.Partial("~/Views/Partials/BusinessVenture/Index.cshtml", new BusinessVenture(BusinessVentName="FunActivity"))
@inherits Umbraco.Web.Mvc.UmbracoViewPage
@{
Layout = "master.cshtml";
var businessventure = new BusinessVenture();
businessventure.BusinessventName = "FunActivity";
}
@* the fun starts here *@
@Html.Partial("~/Views/Partials/BusinessVenture/Index.cshtml", businessventure)
Is it possible to pass in a value from Html.Partial?
I have a simple MVC view where i would like to display or pass in a value from a template to the control and take the appropriate action. Here is the template
The page runs and displays as required.
There are 2 types Business ventures, Fun Activity or Placements.
I have a public property in my code behind
How can i pass the value from the template to the backend code, so if i set it to FunActivity in the template it would take the appropriate action?
I tried adding a parameter to the controller as below but everything i tried resulted in some syntax error.
Is it possible to do this?
try
Hey J, sure you can do that.
Your view
your partial
is working on a reply...