Solved

dynamically display current month

Posted on 2004-09-01
1
199 Views
Last Modified: 2006-11-17
I need to display the current month (right now it should display 9) in a drop down list. How would I modiy this existing code to display the current month?

<font face="Verdana" size="2">Month: <asp:DropDownList ID="Mth" Runat="server">
      <asp:ListItem Value="1"></asp:ListItem>
      <asp:ListItem Value="2"></asp:ListItem>
      <asp:ListItem Value="3"></asp:ListItem>
      <asp:ListItem Value="4"></asp:ListItem>
      <asp:ListItem Value="5"></asp:ListItem>
      <asp:ListItem Value="6"></asp:ListItem>
      <asp:ListItem Value="7"></asp:ListItem>
      <asp:ListItem Value="8"></asp:ListItem>
      <asp:ListItem Value="9"></asp:ListItem>
      <asp:ListItem Value="10"></asp:ListItem>
      <asp:ListItem Value="11"></asp:ListItem>
      <asp:ListItem Value="12"></asp:ListItem>
</asp:DropDownList>

At the end of every month it should automatically display the next month (10, 11, 12....etc.)

Thanks
0
Comment
Question by:jandhb
1 Comment
 
LVL 33

Accepted Solution

by:
raterus earned 25 total points
ID: 11954742
Mth.Items.FindByValue(DateTime.Now.Month.tostring).selected = true
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now