forum

Home / DeveloperSection / Forums / How to add to intgers in mvc razor?

How to add to intgers in mvc razor?

Norman Reedus 1711 10-Nov-2014

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().


Updated on 10-Nov-2014

Can you answer this question?


Answer

1 Answers

Liked By