2 Replies - 1226 Views - Last Post: 19 July 2012 - 04:34 PM Rate Topic: -----

#1 pbivens  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 28
  • Joined: 29-January 12

asp.net and dropdownlist for days of month

Posted 19 July 2012 - 03:02 PM

I have looked all over the net and I can't find help on doing the following routine.I am trying use a dropdownlist to output the days of a month using asp.net and c#. Let me know if you need any more information.I have been able to implement the years and months using dropdownlists.
Is This A Good Question/Topic? 0
  • +

Replies To: asp.net and dropdownlist for days of month

#2 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 441
  • View blog
  • Posts: 1,488
  • Joined: 28-April 09

Re: asp.net and dropdownlist for days of month

Posted 19 July 2012 - 04:28 PM

what have you tried so far to get the days working? Where's your code? What errors are you getting, if any?
Was This Post Helpful? 0
  • +
  • -

#3 pbivens  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 28
  • Joined: 29-January 12

Re: asp.net and dropdownlist for days of month

Posted 19 July 2012 - 04:34 PM

here is the code I am working with.
           if (!IsPostBack)
            {
                int year = System.DateTime.Now.Year;
                
                for (int intCount = 1900; intCount <= year; intCount++)
                {
                    DropDownList2.Items.Add(intCount.ToString());
                }
                
                int month = System.DateTime.Now.Month;
                
                int day = System.DateTime.DaysInMonth(year, month);
                
                for (int intCount = 1; intCount <= day; intCount++)
                {
                    DropDownList3.Items.Add(intCount.ToString());
                }
            }
 

I have almost figured it out,thanks for all the help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1