Hey guys, I've been working in ASP.NET MVC for around a month now and have gotten a decent understanding of Views, shared views, Controllers and their actions, etc but I am still very new and unfamiliar with Models. I am using .NET Core 2.1.
My practice program is set up as follows:
- Fresh project with About and Contact removed, top nav bar just shows "Pay"
- The "Pay" page has a simple HTML form with a couple text input fields and a submit button that moves on to the "Results" page. The goal is for the Results page to show the data that was input on the Pay page
- I have a PayerModel with public vars for PayerName, Address, etc. Both "Pay" and "Results" have the @model inclusion at the top of the file.
- On the Pay page, the input fields and their labels have `asp-for` with a reference to the Model field name
- On the Results page, I want to show (for example) "Payer Name: InputName". Ive tried several things like `@Model.PayerName` but have not been able to find proper syntax here
Do I just need the proper syntax in the Results page? Do I need to add more files/code to sync the Model data? Is this not how Models are supposed to be used?
Thanks!
submitted by /u/Animoose
[link] [comments]
from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/2QYirnF