Комментарии:
Hey Michael. Thanks for the video. I'm teaching myself .NET Core and am trying to get a very simple .Net Core Razor Pages test app to work. It has two pages - a form entry page and a confirmation page that basically says whatever was entered on the form. There's no db or Entity layer here, just a straight post to the confirmation page, so as simple as it can get. I have a Person class in my Models folder. A Person has three props: FirstName, LastName and EmailAddress. I have validation annotations for each of them, including that each is required. When the user clicks Submit, the app accepts the fields even when they're blank or violate other validation rules I've added. ModelState.IsValid always seems to evaluate to True no matter what. I notice that my data entry page has @model set to the page model, understandably, but this makes me think perhaps Visual Studio is never even trying to validate the Person model. The way I associate the Person model with the form is adding it as a property to the page model, like Public Person = Person { get; set; } and preceeding that with a [BindProperty] decoration. Based on what I've described here, any ideas on why my Person class never gets validated?
Ответитьu need to add these lines in app settings of web.config for the client side validation to work
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
took me hours of searching to find
very helpful. Thanks Michael
ОтветитьThanks very much,the tutorial is easy to understand.
Ответитьhye , please explain how to validate dropdownlist. ?
ОтветитьExcellent!!!
Thank you for taking the time to make this vid!
I've found gold!
ОтветитьAll your turtorials are Gem !!!
Ответитьhow do you fix a entity validation property error?
ОтветитьExcellent introduction to data annotations.
ОтветитьGreat tutorial! The subject matter itself is not all that intuitive with all that indirection, but your explanation was very helpful and easy to follow.
ОтветитьThank you man! this was very helpful!
ОтветитьCan you send me a project please?
ОтветитьGreat !
Ответитьnice tutorial, thank u
Ответить