Stepper form data

Advertisements

I am new to dotnet core mvc. So I am asking a suggestion. I have 2 stepper form. I need to get data from this two form , do some validation and finally save this to db. How can I make view and get data from view to controller ? Should I make two view page and two controller ? Or one will be enough ?

Way to achieve this feature

>Solution :

You can create two separate view pages and two corresponding action methods in the controller (one for each step of the form). You can use TempData or Session to store data. Then, in the last action method, you can perform all the necessary validations and save the data to your database. Alternatively, you can use a single view page and use javascript to hide/show different parts of the form based on the current step. Finally, you can use a single action method in the controller to handle the submission and processing of the entire form data.

Tell me if this helps 🙂

Leave a ReplyCancel reply