Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dropdown list creating values from current year

Posted on 2011-03-09
2
Medium Priority
?
398 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
[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
2 Comments
 
LVL 4

Accepted Solution

by:
Tuyau2poil earned 2000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

610 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