dropdownlist format and then convert
- by dinra
i need a dropdownlist to show current month and year (January 2010) till January 2011, and an additional record of January 2011 +.
But I want to save this in the database as 01/01/2010 format. also if the user selects current month then the record should be getdate() to go in database, else for any other month it should be 02/01/2010 (date = 01, first day of month). how do i do this in aspx.vb .net.
i wrote a function to populate the dorpdownlist -
Public Sub Load_dates(ByRef DDL As System.Web.UI.WebControls.DropDownList)
Try
Dim i As Integer
Dim j As Integer
For i = Now.Year To Now.Year
For j = Now.Month To Now.Month + 11
DDL.Items.Add((j.ToString) + " " + (i.ToString))
Next
Next
Catch ex As Exception
ReportError(ex)
End Try
End Sub
this function only shows number like 01 2010 and 02 2010. how can i format this to show january 2010 and february 2010 and so on.
please advice