Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Implementing CustomValiator to Validate Date

$
0
0

I have 3 DropdownList on a page first for day,second for Month,third for year

i am validating date in the SelectedIndexChange eventHandler.

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        Dim dt As Date
        Dim DateString As String = DropDownList2.SelectedValue.ToString & "/" & DropDownList1.SelectedValue.ToString & "/" & DropDownList3.SelectedValue.ToString
        If Not Date.TryParse(DateString, dt) Then
            Label16.Text = "Date is not Valid"
            DropDownList1.SelectedIndex = 0
        Else
            Label16.Text = String.Empty
        End If
    End Sub

I want to implement CustomValidator to Validate Date.Thanks


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>