0
On the Onget of the page I load the Viewbag so:
public IActionResult OnGet()
{
ViewData["SGP_GRP_IdGrupoProduto"] = new SelectList(grupoProdutoService.GetAll(), "GRP_Codigo", "GRP_Descricao");
return Page();
}
When performing the POST on the page and validating the template, if the template is invalid it returns the page but with the empty viewbag (null)
public IActionResult OnPost()
{
if (!ModelState.IsValid)
return Page();
subGrupoProdutoService.Create(SubGrupoProduto);
return RedirectToPage("../View/SubGrupo");
}
What can be done so that when performing the Return page() the viewbag data still remain on the page?