No's Parents :
@{
foreach (var item in Model)
{
((item.Mothers.Count) + (item.Fathers.Count)).ToString();
}
}
O/P: No's Parents:
No's Parents :
@{
foreach (var item in Model)
{
item.Mothers.Count +item.Fathers.Count
}
}
O/p: No's Parents :0+0
I trying to show o/p like, if parents(mother/ father) information not found then display with zero, if mother/ father information exists then display additioinal of Mother.count()+Father.Count().
Anonymous User
10-Nov-2014You can check to see if the sum of both entities is 0, then take action on the result.
This will write "no parents" if both the mothers and fathers items are 0. Otherwise, it will write the number of parents.