When we create a Partial View from the Umbraco Backoffice, a file generated in the ~/Views/Partials folder which has the following contents.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout=null;
}
In the partial view we can use the CurrentPage object in order to access the required information but if we want to create a form which will require the partial view to get a model then we have to change the contents of the partial view so that it will look like the following partial view.
@inherits Umbraco.Web.Mvc.UmbracoViewPage<MyModel>
@{
}
After this change the CurrentPage object is not accessible. In order to get it we will have to add the following declaration.
@inherits Umbraco.Web.Mvc.UmbracoViewPage<MyModel>
@{
var CurrentPage = Umbraco.Content(umbraco.NodeFactory.Node.GetCurrent().Id);
}