M
M
mindgrow2018-04-12 22:41:51
ASP.NET
mindgrow, 2018-04-12 22:41:51

How to implement display of messages about incorrectly filled model on a page with several tabs?

Good afternoon!
Faced such a problem.
There is a profile form, it has 3 tabs: user data, settings and password change.
To display data on the form, I use one ProfileVM model.
To change each individual data block, I use separate models and separate controller methods: ProfileDataVM, SettingsVM, ChangePasswordVM.
The idea is that these data blocks can be changed separately. Schematically, I showed this in the figure
5acfb4ae9f2ba199583045.png
. My problem is that in case of an error in filling in some field of the model, for example, EMail, a message should be displayed on the tab on which the "save" button was pressed. And the url should be Profile/Index.
But it doesn’t work out that way, because. if you go to the Profile/UpdateProfileData controller, and do View(ProfileDataVM) in it, then the data on the filling error will be displayed, but the url will be profile/updateprofiledata
And if you use RedirectToAction("Index", ProfileDataVM) in this method, then the url will be what you need, but there will be no error information.
And how can I be in this situation?
Advise how to solve such problems. I do not want to fence 3 pages of data processing. I want to do everything on one.
For understanding, page template
5acfb67a24ec8260146028.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mindgrow, 2018-04-13
@mindgrow

Implemented via ajax requests

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question