2
Reply

C#: Month field not displaying

Nur Fasiha

Nur Fasiha

Jan 11 2010 8:43 PM
2.4k
Hi. I need some C# expert help.
I have the DOB dropdown and I already got the Day and Year field out to display but not the month. Is there any ways that you could help? 
Here are my codes:
  int col = 0;
                arrDOB = new ArrayList();
                DateTime dob = Convert.ToDateTime(varDOB);

                if (varDOB != "")
                {
                       if (col == 0)
                        {
                            //Populates the day
                            ddlDay.Items.FindByValue(Convert.ToString(dob.Day)).Selected = true;
                            arrDOB.Add(dob.Day);
                        }

                        else if (col == 1)
                        {
                            //Populates the month
                            ddlMonth.SelectedValue = dob.Month.ToString();
                          // ddlMonth.Items.FindByValue(Convert.ToString(dob.Month)).Selected = true;
                           arrDOB.Add(dob.Month);
                          // ddlMonth.Visible = true;
                        } 
                  
                //Populates the year
                ddlYear.Items.FindByValue(Convert.ToString(dob.Year)).Selected = true;
                arrDOB.Add(dob.Year);

                } 

Thanks. :))

Answers (2)