473,396 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to display years( till date) in dropdownlist controls

Dear All,

I am using asp.net2.0

I am trying to display years in dropdownlist from 1980 to till date. Only problem is how can It should show from 1980 to till now that is if years becomes 2008. it should display 2008.

Please guide me in doing so or give me some useful link.

Thanks
Jul 17 '07 #1
2 1933
Dear All,

I am using asp.net2.0

I am trying to display years in dropdownlist from 1980 to till date. Only problem is how can It should show from 1980 to till now that is if years becomes 2008. it should display 2008.

Please guide me in doing so or give me some useful link.

Thanks
hi,
i think you can use DateTime.now.year
or
DateTime.Today.year

so the range will start from 1980 upto the above syntax.
Jul 17 '07 #2
dip_developer
648 Expert 512MB
Dear All,

I am using asp.net2.0

I am trying to display years in dropdownlist from 1980 to till date. Only problem is how can It should show from 1980 to till now that is if years becomes 2008. it should display 2008.

Please guide me in doing so or give me some useful link.

Thanks
try this....

Expand|Select|Wrap|Line Numbers
  1.  
  2. int i,j=DateTime.Now.Year; 
  3. for (i=j;i>1980;i--)
  4. {
  5. ddlYear.Items.Add(i.ToString());
  6. }
  7.  
Jul 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

34
by: kroger | last post by:
Hi. I am at a loss to decipher why the javascript on my web page: http://www.psych.nmsu.edu/~jkroger/lab/index.html does not display the date correctly in Firefox. Instead of "2005" for the...
6
by: Franz | last post by:
Hy all, I have a problem with a date in javascript on firefox Browser. I use this javascript method: var dataNow=new Date(); var dd=dataNow.getDate(); var mm=dataNow.getMonth()+1; var...
2
by: Kiran | last post by:
Hi, Is it possible to display date in different languages depending upon the culture. Thanks Kiran
1
by: Agnes | last post by:
I give up the 'dd-mm-yyyy' bindign question. However, how can i make the text box display date without time ??? Thank
1
by: Olaf Rabbachin | last post by:
Hi folks, I have a table in an Access-DB that has a date-field (date + time). I'd like to use a DataSet + DataGrid to achieve a grouped/hierarchical display where the user would work his/her way...
0
by: keithsimpson3973 | last post by:
Does anyone know if it is possible to display the value of a date picker control on a vb6 form that the user selected on an access report? I am using vb6 to display a report selection and it has a...
2
sumaiya
by: sumaiya | last post by:
how can i display date subtraction
1
by: jackiefm | last post by:
I need to display date ranges for missing data in a query in the following manner: 1/1/08-1/15/08, 126/08, 1/28/08-2/5/08, etc. as opposed to 1/1/08 1/2/08 1/3/08 etc.
1
by: JFKJr | last post by:
Hello everyone, this one might be simple but driving me crazy! Your help will be greatly appreciated. Basically, I created a textbox bound to "Date" field in an Access VBA form. But when the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.