Solved

dynamically display current month

Posted on 2004-09-01
1
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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