Click here to Skip to main content
13,000,636 members (55,555 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi ,

I have drop down lists for Month ,day and year .when i select values in drop down the date will be displayed in text box.its working fine..but im unable to validate leap year for February.
can any one help me regarding this.

im using and below is my code for drop down list.

If Not IsPostBack Then
           ddlMonth.DataSource = Enumerable.Range(1, 12).[Select](Function(a) New With { _
	.MonthName = DateTimeFormatInfo.CurrentInfo.GetMonthName(a), _
	.MonthNumber = a _
           ddlYear.DataSource = Enumerable.Range(DateTime.Now.Year, 10)
           ddlYear.Items.Insert(0, New ListItem("--Select Year--", "0"))
           ddlday.DataSource = Enumerable.Range(1, DateTime.DaysInMonth(DateTime.Now.Year, Convert.ToInt32(ddlMonth.SelectedValue))).Reverse()
           ddlYear1.DataSource = Enumerable.Range(DateTime.Now.Year - 9, 10).Reverse()
           ddlday1.DataSource = Enumerable.Range(1, DateTime.DaysInMonth(DateTime.Now.Year, Convert.ToInt32(ddlMonth1.SelectedValue))).Reverse()
           ddlYear1.Items.Insert(0, New ListItem("--Select Year--", "0"))
       End If

Protected Sub ddlYear_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlYear.SelectedIndexChanged, thnKew.DataBinding
thnKew.Text = ddlday.SelectedItem.Text + "/" + ddlMonth.SelectedValue + " /" + ddlYear.SelectedItem.Text()

End Sub
Posted 28-Jun-13 19:30pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 29 Jun 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100