Solved

Dropdown list creating values from current year

Posted on 2011-03-09
2
345 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

20 Experts available now in Live!

Get 1:1 Help Now