dropdownlist format and then convert
Posted
by dinra
on Stack Overflow
See other posts from Stack Overflow
or by dinra
Published on 2010-01-08T19:40:25Z
Indexed on
2010/05/08
16:08 UTC
Read the original article
Hit count: 145
dropdownlist
|.NET
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
© Stack Overflow or respective owner