i have list,when i bind it and show to view then i m using foreach loop,
i have dob in my list, but i want to show age there, then i want to call javscript function for each binding of dob.
View Code
foreach (var item in Model)
{
<div class="col-sm-6">
<table class="table_working_hours">
<tbody>
<tr class="opened_1">
<td class="day_label1">Age / Height :</td>
<td class="day_value">28, @item.HeightName</td>
</tr>
<tr class="opened">
<td class="day_label1">First Name :</td>
<td class="day_value">@item.First_Name </td>
</tr>
<tr class="opened">
<td class="day_label1">Religion :</td>
<td class="day_value">@item.Religion_Name</td>
</tr>
<tr class="opened">
<td class="day_label1">Id :</td>
<td class="day_value">@item.User_id</td>
</tr>
<tr class="closed">
<td class="day_label1">DOB :</td>
<td class="day_value closed"><span>@item.DOB</span></td>
</tr>
Controller
var userlist1 = (from u in db.User_Detail
join st in db.State_Name on u.State equals st.State_Id
join h in db.Height_Table on u.Height equals h.Height_Id
join cntry in db.Country_Name on u.Country equals cntry.Country_Id
join e in db.Education_Qualification on u.Education_Qualification equals e.Education_Id
where u.Gender == 2 && u.DOB <= dob21 && u.DOB >= dob22
select new users_details
{
First_Name = u.First_Name,
Last_Name = u.Last_Name,
Annual_IncomeName = incm.Annual_Income,
Caste1 = cast.Caste1,
Religion_Name = rlgn.Religion_Name,
Language = leng.Language,
EducationName = e.Education,
StateName = st.State,
User_id = u.User_id,
CountryName = cntry.Country,
HeightName = h.Height,
DOB = u.DOB
});
i want to to calculate age for each item according to DOB and to write in place of Age .
but my DOb Format is 1990-08-23