V
V
VanilaSpirit2020-07-09 13:08:03
ASP.NET
VanilaSpirit, 2020-07-09 13:08:03

How to properly validate ASP.NET?

Let's say we have a "Person" model, which has the usual list of properties (id, name, age). It also has a property - does it work now (yes / no), in the case of a positive option - add a new field - place of work, in the case of a negative one - remove it.

How to apply validation on the "place of work" field, because this field may not exist?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
fan92rus, 2020-07-09
@fan92rus

For all users to keep a list of jobs. but only if the user marks (that works) isEmployed then we add it to the list and display the additional menu in the gui.
Plus, can you use it? (null collision operator) when getting the list (and again, if it returns null, then we don't show anything).

D
Dmitry Pavlov, 2020-07-09
@Stalker31

Use construction

if(/*если работает сейчас*/){
/*выполнить необходимые действия с полем*/
}
else{
/*оставить в поле значение null*/
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question