This topic is locked

Date Field

8/7/2006 9:06:32 AM
ASPRunner.NET General questions
C
colinmac author

Hi I have setup and ASP.net v.2.0 database and it is all working fine. The only problem I have is the dropdown boxs for the dates. They only go back to 1956 and I require dates back further than that. I found how to change it in ASP runner but not in ASP runner NET. Could you help me out please
Colin

Eugene 8/7/2006

Use edit format: "Simple edit box with datepicker"

You can choose this edit format on page "Formatting" (Step 7)

C
colinmac author 8/7/2006

Hi Eugene, at the moment I am using the drop down box with datepicker option. The date picker shows years earlier than 1956 but won't insert data if you select say 1945. The drop down box displays years only back to 1956. I had this problem with ASP runner and fixed it with the link below
http://www.asprunner.com/forums/index.php?...ic=2488&hl=1956
The pages aren't the same in ASP runner NET so I can't use this fix again
Colin

Eugene 8/8/2006

You can edit function "DateToDropDownList" in file lib.cs (lib.vb)

for c# replace

for (int i = (dt.Year == 1?DateTime.Now.Year:dt.Year) - 50; i <= (dt.Year == 1?DateTime.Now.Year:dt.Year) + 50; i++)



with

for (int i = 1850; i <= (dt.Year == 1?DateTime.Now.Year:dt.Year) + 50; i++)


or
for vb.net replace

i = (IIf(dt.Year = 1, DateTime.Now.Year, dt.Year)) - 50



with

i = 1850
C
colinmac author 8/14/2006

You can edit function "DateToDropDownList" in file lib.cs (lib.vb)

for c# replace

for (int i = (dt.Year == 1?DateTime.Now.Year:dt.Year) - 50; i <= (dt.Year == 1?DateTime.Now.Year:dt.Year) + 50; i++)



with

for (int i = 1850; i <= (dt.Year == 1?DateTime.Now.Year:dt.Year) + 50; i++)


or
for vb.net replace

i = (IIf(dt.Year = 1, DateTime.Now.Year, dt.Year)) - 50



with

i = 1850


Thanks a lot thats done the trick!

M
mickj 4/14/2007



Thanks a lot thats done the trick!


Picking up on this same subject, I have also managed to amend the lib.vb to only allow the display date to be this year or next year so as to avoid mistakes.
However in the date picker ( from calendar.js I assume) this still has the full date range.

Is it possible to mirror the same process in the Date Picker?

I've looked at the calendar.js script but far too complex for me to mess around with :-)