TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marius Vasile
589
1.9k
148.5k
asp.net core validate a bool value
Mar 5 2021 7:54 AM
I have a bool value for which I cannot use default validation at Model stage because in one form it can be false but in another it has to be true. I want that if is true to allow post if not, not
<div
class
=
"col-md-4 text-center"
>
<label
class
=
"form-control text-white pl-2"
style=
"background-color:firebrick;"
> Equipment Available?</label>
<div
class
=
"d-flex justify-content-center mt-3"
>
<input asp-
for
=
"WOPlanner.ToolsAvailable"
type=
"checkbox"
data-width=
"200"
data-toggle=
"toggle"
data-on=
"Yes"
data-off=
"No"
data-onstyle=
"success"
data-offstyle=
"primary"
value=
"@Model.WOPlanner.ToolsAvailable"
/>
</div>
</div>
the value I take is from the table which allows false but it should not allow post through
<div
class
=
"row no-gutters border border-0 "
>
<div
class
=
"col-md-3 mt-2"
>
<button asp-page-handler=
"WOSchedule"
asp-route-womainid=
"@Model.WOMainID"
class
=
"col-md-12 btn btn-link font-weight-bold"
style=
"border-color:firebrick; background-color:lightgray; color:firebrick"
type=
"submit"
>Submit</button>
</div>
</div>
Reply
Answers (
13
)
Work on the side with ASP.NET MVC?
how to write generic polymorphic deserilization custom converter