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.
Find age
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

DRISHTY134 reputationPosted May 13, 2010, 5:48 AM EDT
// 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--;
CrishRank #1,487 · 1.1K reputationPosted May 13, 2010, 5:56 AM EDT
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
rohit manhas12 reputationPosted May 14, 2010, 9:17 AM EDT