thanks though does not recognize ViewBag, only ViewData
Replacing ViewBag.Number with ViewData ["Number"] does not show an error, but passing a number does not print anything.
Is there another way?
The code shared above has been tested and it works just fine. Share you code if you need a community code review. Perhaps you are building a Razor Pages application?
public class FormModel : PageModel
{
public void OnGet()
{
}
public void OnPost(decimal number)
{
Number = (number * 0.25m);
}
[BindProperty]
public decimal Number { get; set; }
}
All-Star
52141 Points
23248 Posts
Re: Process Form Data
Oct 29, 2020 02:27 PM|mgebhard|LINK
The code shared above has been tested and it works just fine. Share you code if you need a community code review. Perhaps you are building a Razor Pages application?
Razor Pages Tutorials
https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-3.1&tabs=visual-studio