Asp.net compare validator to validate date

后端 未结 4 659
南方客
南方客 2021-01-04 11:36

As you all know Compare validators can be used to validate dates and check based on operator type (<, <= , >= etc). I have set the cultureinvariantvalues=\"true\

4条回答
  •  春和景丽
    2021-01-04 12:15

    Compare validator has the type=date.But that date type is constrained to accept only particular format of date i.e ToShortDateString(). If the date format of the two textboxes to be compared is in some other format like ToLongDateString() or some format specified by ToString("dd MMMM,yyyy") the comparision does not work. CustomValidator isonly option. If you want to use compare validator only then

    textstartdate.text=Calendar1.SelectedDate.ToShortDateString();
    textfinishdate=Calendar2.SelectedDate.ToShortDateString();
    
    

提交回复
热议问题