Skip to content

How to check that DatePicker is not empty? #4566

Answered by stsrki
elshorbagy asked this question in Q&A
Discussion options

You must be logged in to vote

You should check the binded value, not the field or method of the DatePicker

Example

<DatePicker @bind-Date="@selectedValue" />
@code{
  DateTime? selectedValue;

  void SomeMethod()
  {
    if(selectedValue == null)
      // do something
  }

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@elshorbagy
Comment options

@stsrki
Comment options

Answer selected by elshorbagy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants