how to perform validations in mvc if there is no database attached only ado.net coding is there.
e.g.
if a textbox is empty then no record should inserted and error message appears how to do that
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nilesh ShahPosted Jul 31, 2017, 2:34 PM
Hi,
and it works fine
umair mohsinPosted Jul 31, 2017, 1:28 PM
Create
Nilesh ShahPosted Jul 31, 2017, 12:39 PM
Puneet KankarPosted Jul 31, 2017, 12:33 PM
umair mohsinPosted Jul 31, 2017, 11:31 AM
Nilesh ShahPosted Jul 31, 2017, 9:52 AM
What you want is input validation, it's irrespective of your code in database side.
Input validation in MVC is super easy, it's done via Required attribute which is placed on top of your class's property (view model class).
This is what you write in view to show validation message:
@Html.ValidationSummary("", new { @class = "text-danger" })