Solved

Dropdown list creating values from current year

Posted on 2011-03-09
2
367 Views
Last Modified: 2012-05-11
I am using dot net and I want to create a dropdown list that contains the current year and the next ten years. I am not sure how to populate the table.  

Something like below which does not work.

    <asp:DropDownList ID="DropDownList1" runat="server">
                <asp:ListItem Value="=year(getdate())"></asp:ListItem>
                 <asp:ListItem Value="=year(getdate() + 1)"></asp:ListItem>
            </asp:DropDownList>
     

0
Comment
Question by:kw66722
2 Comments
 
LVL 4

Accepted Solution

by:
Tuyau2poil earned 500 total points
ID: 35088731
populate your DDL with codebehind :

 Dim intYear As Integer
    Dim intStart As Integer = DateTime.Now.Year
    Dim intEnd As Integer = DateTime.Now.Year + 10
 
    For intYear = intStart To intEnd
        DropDownList1.Items.Add(intYear.ToString())
    Next
0
 
LVL 1

Author Comment

by:kw66722
ID: 35089907
that worked.  I created a control and up the code in the init event.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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