Hi,
I tried
var maxId = HouseList.Max(h => h.HouseId);
but i get error as
Sequence contains no elements
But I had loaded element into list as
public void LoadHouse()
{
_stx = new CPMDomainContext();
LoadOperation<House> lo = _stx.Load(_stx.GetHousesQuery());
HouseList = lo.Entities;
}
I use HouseList as ItemSource for a combobox..It binds data..But while i check HouseList.count always zero.How can i get elements from HouseList.Help me..
anand PPosted Aug 24, 2012, 1:15 PM
My combobox is in view.I bind it from view model by having a list called HouseList.
I can get value from combobox itself.But i don't know how to pass this value to my view model.
so i try to take value from HouseList in viewmodel itself.
VulpesPosted Aug 24, 2012, 11:23 AM
If so, then perhaps your best option is to get the elements from the combobox itself.
anand PPosted Aug 24, 2012, 8:47 AM
i tried it..Now also HouseList.count is zero.
and the following throw exception.
var maxId = HouseList.Max(h => h.HouseId);
Sukesh MarlaPosted Aug 24, 2012, 6:32 AM
Do like this
List HouseList =lo.Entities.ToList();
Now Bind HouseList to DropDown
and now it will work
var maxId = HouseList.Max(h => h.HouseId);
Check this is correct answer if it helped
anand PPosted Aug 24, 2012, 6:02 AM
VulpesPosted Aug 24, 2012, 5:00 AM