I have a grid that holds rows of a Recipient record. The Recipient record has a number of foreign keys, e.g. PrimaryCaregiver, StatusId, NeedId, FacilityId, etc. that basically point to lookup tables.
The problem is filtering on the PrimaryCaregiver and NeedId - StatusId works fine.
@{
var person = (context as CareReceiverDto);
var status = (Statuses.FirstOrDefault(s => s.StatusId == person.StatusId)).Name;
@status
}
@{
var filterContext = (context as FilterItemTemplateContext);
int value = int.Parse(filterContext.Value.ToString());
var statusName = (Statuses.FirstOrDefault(s => s.StatusId == Convert.ToInt32(filterContext.Value))).Name;
}
@statusName
I use a Template and a Filter Template and the filtering and display are just fine.
When I attempt to do the same on the NeedId no filtering options are shown etc.
@{
var person = (context as CareReceiverDto);
var needs = RecipientNeeds.Where(i => i.CareReceiverId == person.CareReceiverId).ToList();
foreach(var need in needs)
{
@need.PrayerNeed
}
}
@{
var filterContext = (context as FilterItemTemplateContext);
var name = Needs.FirstOrDefault(n => n.NeedId == Convert.ToInt32(filterContext.Value)).PrayerNeed;
}
@name
What am I doing wrong here?