i had two Textboxes.
In one Textbox i
used ajax calender to find the date of
birth and in second Textbox i want to
generate age dynamically before
submitting the form.iam using asp.net
and c#..cud anyone plz tell me hw to
do it.
Loading
rohit manhasPosted May 14, 2010, 1:17 PM
CrishPosted May 13, 2010, 9:56 AM
on change or on blur of calender textbox you can call javascript function to show Age in other textbox.
!) make javascript function and call it onchange of calender textbox.
2) compare calender date with current date and display age in other textbox.
thanks
DRISHTYPosted May 13, 2010, 9:48 AM
// get the difference in years
int years = DateTime.Now.Year - BirthDate.Year;
// subtract another year if we're before the
// birth day in the current year
if (DateTime.Now.Month < BirthDate.Month ||
(DateTime.Now.Month == BirthDate.Month &&
DateTime.Now.Day < BirthDate.Day))
years--;