Datagrid select all not working

Hi,

I am trying to select all records in a datagrid using the header/row checkbox setup.

When I check the header checkbox it shows up as selected but the rows in the grid do not. I have checked the selectedItems property and it gets updated correctly. I can also select individual rows. When I unselect the header checkbox it works, all the items that I manually selected get unselected.

The grid just does not reflect when I check the header checkbox (select all)

Change event of the header checkbox.
Execute C#
if ( (bool)args == false)
{
selectedItems = new List<FlexBilling.Models.Billingsqlserver.VwJobListingUnbilled>();
}
else
{
selectedItems = getVwJobListingsResult.ToList();
}

Checkbox value property
${selectedItems != null && selectedItems.Count > 0}

image

What am I missing here?

Pages.zip (2.7 KB)

I have figured out that this is happening because my data is coming from a view and so entity framework can not figure out the key and hence the selectedItems.Contains() is not working as it should. So I had to create a new comparer

public class VwJoblistingUnbilledComparer : IEqualityComparer
{
public bool Equals(VwJobListingUnbilled x, VwJobListingUnbilled y)
{
if (x.job_id == y.job_id)
{
return true;
}
else
{
return false;
}
}
public int GetHashCode(VwJobListingUnbilled obj)
{
return obj.GetHashCode();
}
}

and the item checkbox value = ${selectedItems != null && selectedItems.Contains(data, new VwJoblistingUnbilledComparer())}